What can lead to a zone memory exhaustion and how Nginx reacts to it?

Posted by Miles Hughes on Server Fault See other posts from Server Fault or by Miles Hughes
Published on 2012-12-07T21:06:14Z Indexed on 2012/12/08 5:09 UTC
Read the original article Hit count: 480

Filed under:
|
|
|
|

What is a possible scenario for exhausting the memory designated to a connection zone with limit_conn_zone directive and what are the implication in this case?

Suppose I have this in my configuration:

http {
  limit_conn_zone $binary_remote_addr zone=connzone:1m;
  ...
  server {
    limit_conn connzone 5;

which, according to the documentation, allocates 16000 states for connzone on a 64-bit server. It also says that

If the storage for a zone is exhausted, the server will return error 503 (Service Temporarily Unavailable) to all further requests.

Well, Ok. But what does it mean on practice? When does this happen? Who receives those 503s? Does it mean that if the number of IPs somehow associated with connzone hits 16000 everyone gets a 503 and it's all over? How does Nginx decide? The documentation is weirdly vague on this.

So, considering the example config, who would actually get a 503 and under which circumstances and how would things go from there? Same with request zones?

© Server Fault or respective owner

Related posts about linux

Related posts about nginx