[PATCH] Fix drain logic for small number of connections

Maxim Dounin mdounin at mdounin.ru
Wed Dec 28 17:05:15 UTC 2016


On Tue, Dec 27, 2016 at 04:37:36PM -0600, Joel Cunningham wrote:

> Ping…any interest in accepting this patch?

I'm not sure this patch improves things.

Currently, 32 means that under constant load nginx will drain old 
connections once per 32 connection attempts.  With the patch, 32 
is reduced to a smaller number, but this doesn't make any 
difference under constant load: if there are enough connections 
accepted on the current event loop iteration, all connections from 
the previous event loop iteration will be closed as long as they 
haven't managed to provide some data. 

The difference may occur if worker_connections limit is reached 
occasionally: in this case smaller number can mean that not all 
keepalive connections will be closed.  But it is not clear how 
this is different from a server with a large number of established 
connections and only a small number of reusable ones.

It is also not clear why use so small number of worker 
connections, but this is another question.

Maxim Dounin

More information about the nginx-devel mailing list