I have three servers, the load balancer runs nginx and passes the PHP requests upstream to one of two servers running php-fpm.
I was actually trying to test concurrency in the first place, so the php script on each PHP-FPM server shows a start and end time as well as the hostname, and after the start time is echoed it uses 100% CPU for 5 seconds before echoing the end time.
Neither server hits 100% CPU simultaneously for 4 concurrent requests and the timestamps show they are served consecutively which makes me think nginx and fastcgi is blocking all concurrent connections.
Running ab with 100 concurrent connection sees all processes on one PHP-FPM server (out of 10 available) processing and the other server is completely quiet doing nothing.
The nginx conf is:
upstream backend {
server 192.168.1.60:9000;
server 192.168.1.61:9000;
}
server {
listen 80;
server_name localhost;
access_log /var/log/nginx/localhost.access.log;
location / {
root /var/www;
index index.php;
}
location ~ .php$ {
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_pass backend;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www$fastcgi_script_name;
include fastcgi_params;
}
}