Optimizing worker_processes, worker_connections & PHP_FCGI_CHILDREN - Any Good Tutorial?

Rahul Bansal rahul286 at gmail.com
Tue Jun 15 23:37:18 MSD 2010

Thanks Reinis for your time and valuable info.

> The preferred way (especially for high concurrency) is to spawn the php as permanent process and
> the webserver (nginx) talks to it through fastcgi  ( http://wiki.nginx.org/NginxHttpFcgiModule )

I have setup my nginx as mentioned here -
And I guess for this reason my APC cache is working fine! :)

>spawn-fcgi was kinda early way to do this (came from lighttpd) but now the inbuilt FPM sapi has much more control and options ...

I am really convinced about PHP-FPM and will definitely give it a try.
Specially "upstream" stuff.

>The basic approach usually as far as I know is to set worker_processes based on your CPU core count ...
In VPS, even with linode/slichost company, you see 4 cores when you
cat /proc/cpuinfo
But as its VPS and not PS, cores may be shared by some unknown fellows.
Do u still think, keeping core_count math still helps?

> So in short - both of the software products are clever enough to tell you what could be the optimal setting for you based on the workload of the box.
Agree. Switching to nginx was one of my best decision.
Fellow bloggers envy my servers uptime and speed and the fact is I pay
less in terms of hosting bill ;-)

> remember also to tweak other system settings - like maximum open file descriptors, tcp port range etc
I will check this out. Looks like I never traveled in this direction.

Thanks again Reinis.


More information about the nginx mailing list