1

I'm running Lighttpd on 256MB RAM VPS (with low estimated traffic).

In order to optimize my server performances I decided to change these settings:

                    "PHP_FCGI_CHILDREN" => "1",
                    "PHP_FCGI_MAX_REQUESTS" => "20"

The reason why I set 1 child is that with setting there are 4 php_cgi processes:

2413 11336 /usr/bin/php-cgi 2415 4592 /usr/bin/php-cgi 2417 11336 /usr/bin/php-cgi 2419 27656 /usr/bin/php-cgi

If I set 4 I get >8 children. I'm wondering why and if this is ok. Now my webserver is very fast, because I finally don't rely on swapping so massively as before.

thanks

2 Answers 2

2

As you can see in this FAQ there are three config options that control the number of mod_php processes.

  • PHP_FCGI_CHILDREN (defaults to 1)
  • max-procs (defaults to 4)
  • min-procs (ignored in current releases)

The formula to caluclate the initially spawned processes looks like this:

no_of_procs = max-procs * ( PHP_FCGI_CHILDREN + 1) 

This means, for every procs in max-procs launch PHP_FCGI_CHILDREN workers +1 Guardian process for each parent in max-procs.

0

For newer lighttpd instances, you should set PHP_FCGI_CHILDREN to 0 and control the number of instances spawned.

This can help reduce the number of total processes running as there does not need to be extra master processes. However, if you are using a bytecode cache, set only 1 spawned master process and control the children below it.

Set PHP_MAX_REQUESTS to 500 to avoid another potential problem.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .