Nginx gets halt on 15K connections !!

Valentin V. Bartenev vbart at nginx.com
Fri May 8 13:05:14 UTC 2015


On Thursday 07 May 2015 18:38:23 shahzaib shahzaib wrote:
> Hi,
> 
>   It looks like we made the false calculation based on entertaining
> concurrent connections per seconds and worker_connections limit was set to
> be very low. I've increased this limit to 16000 and issue looks to be
> fixed. Here's the mechanism i used to calculate concurrent connections/sec:
> 
>  worker_processes * worker_connections / keepalive_timeout == concurrent
> connections per second
> 
> Concurrent connections on our server is around 15K . Based on this i used
> the following values :
> 
>  48 * 16000 / 15 == 51200/sec
> 
> Can somebody point to me if the calculation method is false ?
> 
[..]

It's false.

The keepalive_timeout has nothing to do with the concurrent connections per second.
In fact, nginx can close an idle connection at any time when it reaches the limit
of worker_connections.

What's really important is the connections that nginx cannot close.  The active ones.
How long the connection is active depends on the request processing time.

The approximate calculation looks like this:

 worker_processes * worker_connections * K / average $request_time

where K is the average number of connections per request (for example, if you do proxy
pass, then nginx needs additional connection to your backend).

  wbr, Valentin V. Bartenev



More information about the nginx mailing list