How to make nginx proxy php to fastcgi evenly on all cores.
Top shows usage of only 2 cores when I try to stress test configuration.
Cpu0 : 62.6%us, 14.9%sy, 0.0%ni, 18.5%id, 0.3%wa, 0.0%hi, 3.6%si, 0.0%st
Cpu1 : 57.1%us, 11.0%sy, 0.0%ni, 31.2%id, 0.0%wa, 0.0%hi, 0.7%si, 0.0%st
Cpu2 : 1.3%us, 0.7%sy, 0.0%ni, 97.0%id, 0.0%wa, 0.0%hi, 1.0%si, 0.0%st
Cpu3 : 2.0%us, 1.7%sy, 0.0%ni, 95.7%id, 0.0%wa, 0.0%hi, 0.7%si, 0.0%st
I got
worker_processes 20;
Set in nginx.conf
Start fast cgi with
spawn-fcgi -s /tmp/php.sock -f /usr/sbin/php -u nobody -g nogroup -U nobody -G nogroup -C 160 -P /var/run/spawn-fcgi.pid
And proxy block in nginx.conf that calls fast cgi is
location ~ \.php$
{
include fastcgi_params;
fastcgi_pass unix:/tmp/php.sock;
fastcgi_param SCRIPT_FILENAME /var/www/$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_script_name;
}