How to effectively have less php-cgi processes running?

Posted by João Pinto Jerónimo on Server Fault See other posts from Server Fault or by João Pinto Jerónimo
Published on 2012-02-10T22:34:07Z Indexed on 2012/12/12 11:07 UTC
Read the original article Hit count: 233

Filed under:
|
|

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 ?

© Server Fault or respective owner

Related posts about php

Related posts about lighttpd