Optimizing worker_processes, worker_connections & PHP_FCGI_CHILDREN - Any Good Tutorial?

Jérôme Loyet jerome at loyet.net
Wed Jun 16 00:06:33 MSD 2010


2010/6/15 Rahul Bansal <rahul.bansal at rtcamp.com>:
> Hi jerome.
>
> With your additional inputs, Can I safely set following rules for personal
> use?
> Of course, any configuration needs monitoring/tweaking. But I think its
> better to start with a base config which will be closer to the optimal
> config.
>
> Now for...
> worker_connections
> 1024/2048 are safe values. So its better if I leave them untouched.

depends on your visitors load. You can go higher than that if needed.
But I don't think it's you case

>
> worker_processes
> Number of CPU core or its multiplier (assuming u have dynamic application
> with decent caching)
> More process ==>> Less Dynamic and Lower PHP_FCGI_CHILDREN
> Less Process ==>> More Dynamic and Higher PHP_FCGI_CHILDREN

worker_process = num of CPU. nothing more

>
> PHP_FCGI_CHILDREN
> Using TOP command and looking at RES memory value.
> Finding memory required by single instance of PHP. (in my case its 40MB and
> VIRT is 100MB!)
> Then doing arithmetic like:
> [Available RAM] = (Actual RAM) - (100 M or more OS + 200 M for DB + 16M for
> nginx (I have 8 worker_process with 2MB memory for each ))
> Then,
> PHP_FCGI_CHILDREN  = [Available RAM] / Single PHP instances' memory
> requirement

you can save more of OS as there is file caching which is usefull

>
> Sorry for trying to get mechanical here.

it's a good start, then you'll tweak

>
> But I already started to have better insight into all configuration
> variables I was curious at.
>
> Also are these numbers in anyway gets affected by fastcgi_cache -
> http://wiki.nginx.org/NginxHttpFcgiModule#fastcgi_cache
> Does fastcgi_cache reduces load on fascgi-php ?

Oh hell yes !
a dynamic content nginx is serving from cache won't generate any load
on the fcgi side as it won't go there



More information about the nginx mailing list