Limit_zone and limit_conn problem.

Maxim Dounin mdounin at mdounin.ru
Fri Jan 22 23:52:47 MSK 2010


Hello!

On Fri, Jan 22, 2010 at 08:56:53PM +0100, Piotr Karbowski wrote:

> Hi list, I have smillar problem like
> http://markmail.org/message/m5mau3i4yxkw46rj [ Problems using
> limit_zone and limit_conn ]

This is believed to be what's called "insufficient testing" and 
just doesn't trigger 503 because it's hard to trigger unless you 
are downloading big response which fills all the socket buffers 
or nginx is waiting for a backend during processing of a request.

> How this limit_conn work? I have limit_conn   one  1; but still I can
> do many connections and download without 503 error or something.

limit_conn do something like this:

1. On request processing start (once all headers have been read) 
it checks if limit_zone has number recorded for the variable in 
question, and if it's bigger than allowed - returns 503.  if it's 
still bellow allowed maximum - increments number (or stores 1 if 
there were nothing recorded so far).

2. On request completion (when we are done sending data to client 
and connection is about to be closed or goes into keepalive state) 
number in question is decremented.

Maxim Dounin



More information about the nginx mailing list