I am asking about a web server running a light front (nginx in my case), with PHP processes accessed through fastcgi.
I am trying to figure out a way to methodically calculate how many PHP cgi processes should be running in the machine.
One way to think of it is figure out the average memory footprint of a process, and run as many as possible within the limits of available RAM. However, this does not bring CPU usage into the question.
Since CPU is the real bottleneck in my application (DB and memcache are used, but are not the bottlenecks), I am thinking that the base number for php processes should be the number of CPUs available.
For example - in an 8 core machine, the base number would be 8. Assuming some processes do wait for database or network, I do not see any reason to run more than 20 PHP processes alltogether.
Does that way of thinking make sense? How do you calculate how many processes to run?