AWS HAProxy latency to Nginx?

Reinis Rozitis r at
Mon Jul 11 22:24:18 MSD 2011

> On the HAProxy built-in admin stats, I see ~200 current sessions for the
> server, but I only see ~80 php-fpm processes running (ps -ef, and also
> checking the php-fpm.log).

A session doesn't really mean that everything is php related - there might be a static content fetches (for example if the same 
nginx/backend serves also images) and/or keepalive connections. Besides a single php child if the application code is optimal can 
manage to complete way more than 1 request per a given time period (1 second).
Personally I feel that 80 php process for 200 req/sec is somewhat too much - I try to to keep like 200-300 req/sec per 10-20 childs 
and bash the programmers for every page which doesn't load in 0.0x secs.

You didn't post the FPM manager line (eg something like pm = dynamic) that way the php-fpm master process spawns extra childs when 
there is a need (also informs in the log file if the max setting is too low) and kills the unneeded ones.

> I just want to make sure that I'm not introducing a bottleneck due to my configuration and want to make sure we're handling all 
> the requests we should be.

For sure nginx won't be the bottleneck.

The php part depends on the specific application - eg there easily can be code that completes in nano/micro-seconds while the same 
time some people easily manage to write endless loops etc (btw php-fpm has a nice feature to monitor/backtrace such scripts and 
forcibly kill if they take too long ).

But to make 100% sure HaProxy offers a neat status page where you can see the connection/request error counts that way indicating if 
there is a problem at the backends.

For extra debug you always enable logging on both instances (frontend / backend) and compare the incoming / forwarded and served 


More information about the nginx mailing list