My server is a Linode 512, and on it I run a Wordpress MU with 3 websites (they don't get a lot of visitors) and a couple of NodeJS apps.
I need to switch to Lighttpd because Apache 2 was using about 59% of the server's RAM, and now I have the php-cgi processes taking up about 43.6% of the server's RAM:
- most often 2 processes use 16.5% of the RAM each,
- 4 processes use 1.8% of the RAM each, and
- 4 more processes use 0,8% of the RAM, each
How can I have less of these processes ? I'm almost sure they're not all needed for the trafic this server gets...
I tried only allowing 2 children, but I still have those 10... This is my fastcgi.server section in lighttpd.conf.
fastcgi.server = ( ".php" =>
( "localhost" =>
(
"socket" => "/var/run/lighttpd/php-fastcgi.socket",
"bin-path" => "/usr/bin/php-cgi",
"bin-environment" => (
"PHP_FCGI_CHILDREN" => "2",
"PHP_FCGI_MAX_REQUESTS" => "4000"
)
)
)
)
What else can I do to tune lighttpd to use less RAM ?
If you set bin-path then lighttpd is responsible for spawning fcgi processes, limited by:
Environment variable PHP_FCGI_CHILDREN is an additional hint to php executable to internally spawn more processes, you can set it to zero.
You don't specify max-procs so there is 4 procs spawned by lighty and each of them has two additional childrens -- 4[max-procs] * (1+2[PHP_FCGI_CHILDREN]).
Check out the lighttpd documentation regarding php-cgi. It seems that you may need to set the
max-procs
directive to limit the total number of children processes.