nginx-keepalive - Connection count

Maxim Dounin mdounin at
Fri Sep 23 14:08:41 UTC 2011


On Fri, Sep 23, 2011 at 02:25:59PM +0100, Karl Royer wrote:

> I have been using the upstream keepalive module and found that the
> pool size does not place an upper limit on the number of upstream
> connections, but instead simply makes another connection if the pool
> size is exceeded. This can be an issue when too many upstream
> connections can cause a DoS attack on the upstream resource. 

This is by design.  Directive "keepalive" allows to specify number 
of connections kept in each worker's connection cache.  It's not 
expected to limit total number of connections opened to upstream 

> Could an
> option be added to make it wait for a connection to return to the
> connection pool - which places an upper limit on upstream connections ?

Currently no, this requires changes in upstream infrastructure.  
And even with the required changes I'm not sure it's up to 
keepalive code to maintain the limit.

Maxim Dounin

More information about the nginx-devel mailing list