Questions regarding worker_connections

Maxim Dounin mdounin at
Mon Aug 27 18:18:13 UTC 2018


On Mon, Aug 27, 2018 at 10:31:13AM -0700, Alder Netw wrote:

> Thanks Maxim for the info. So worker  connections in waiting state may not
> be
> ready to be reused. Is there any maximum waiting time? We seem to run into
> a condition that those connections are permanently stuck in waiting state.

Waiting connections are connections in the keepalive state and/or 
idle HTTP/2 connections.  Relevant timeouts can be tuned using the 
keepalive_timeout and http2_idle_timeout directives, see docs 

> Also, what would be the ball-park number of worker_connections  should be
> set
> if we want to support expected number of active connections, say 150?

If you are sure the number of active connections (that is, reading 
+ writing + waiting) will never exceed 150, you can set 
worker_connections to a similar number, adding some for various 
other uses - including listening sockets and upstream connections.  
Usually 2x of the expected maximum number is a good estimate.

In the particular case of 150 active connections, it should be a 
good idea to preserve "worker_connections 1024" as suggested by 
the default configuration.  Simply because it hardly make sense to 
use anything smaller.

Maxim Dounin

More information about the nginx mailing list