httpd w/PHP performance

Lauri Kasanen curaga at operamail.com
Wed Jun 20 17:52:13 UTC 2012


On Wed, Jun 20, 2012, at 10:36, George Pontis wrote:
> I have an application that runs well using lighttpd with PHP. In an
> effort
> to reduce the memory footprint I tried porting it to the busybox ( 1.20.1
> )
> httpd. It was easy to get this working and it seems to work properly.
> What
> isn't good enough is performance when executing PHP scripts. It looks
> like
> the httpd is using fork/exec for each cgi, and that fork/exec can use a
> lot
> of CPU. There might also be some downsides to repeated alloc/free in the
> embedded environment. By comparison, lighttpd starts a programmable
> number
> of php-cgi processes at startup, then keeps them around and just feeds
> scripts to them as needed. It is feasible to go back to lighttpd but
> before
> giving up for this reason, I wanted to ask if my understanding or build
> of
> the httpd is incorrect in some way. Any thoughts, suggestions, comments ?

Nope, what you're seeing is the difference between two approaches: bb
forks both for each connection _and_ each CGI request, so if you mainly
use PHP, that's two forks per request. Lighty uses single-threaded
events + you have configured fastcgi PHP (you could use cgi(/fork) PHP
with lighty too, but why would you want to).

- Lauri

-- 
http://www.fastmail.fm - A fast, anti-spam email service.



More information about the busybox mailing list