NginX behavior when reaching maximum worker connections

nginx

I'm trying to use NginX to replace Apache as a load-balancer/reverse-proxy to a highly loaded service. Currently I have Apache configured with a maximum of 1024 workers on each proxy server – where I have several of them so the actual capacity is much higher. Still, at times there are more then n * 1024 simultaneous connections and in such cases Apache will queue incoming requests and will serve them once workers become available again.

With NginX it is not so, as if a connection is coming in when all the worker processes have all their connections taken – then NginX will reject the connection outright (not even a 500 error response). Is there a way to configure NginX to queue the new request instead of rejecting it?

Best Answer

No. Increase the amount of connections a worker may handle. 1024 is much lower than Nginx can handle.

If you need to limit the amount concurrent of concurrent requests passed to a back end then you need a 3rd party module like: https://github.com/ry/nginx-ey-balancer