Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

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

share|improve this answer
    
Ok, but I still need a queuing mechanism to limit the number of workers on my backend - I was using Apache for this but Apache takes too much memory (~4M per worker), hence Nginx. What can I use instead? –  Guss May 7 '11 at 16:09
    
You'll need to install a 3rd party plugin then, I have edited my answer to include the plugin link. –  Martin Fjordvald May 7 '11 at 17:27
    
Ah, this is not exactly what I was looking for - I was more about queueing of the incoming connections while nginx-ey-balancer is about queueing outgoing connections, but I guess that if I increase the incoming max_connections to some ridiculous value and set up upstream max_connections to 1024/workers/upstream servers and assuming uniform distribution (which I know is not the case because I'm using ip_hash, but hopefully it won't matter much) then I should be OK. Its going a bit backwards about the whole thing, but it just might work well enough - thanks! –  Guss May 7 '11 at 18:38

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.