[PATCH] Fix drain logic for small number of connections
mdounin at mdounin.ru
Thu Jan 19 13:03:11 UTC 2017
On Tue, Jan 17, 2017 at 09:37:58AM -0600, Joel Cunningham wrote:
> > On Dec 30, 2016, at 8:04 PM, Maxim Dounin <mdounin at mdounin.ru> wrote:
> > Hello!
> > On Fri, Dec 30, 2016 at 12:13:01PM -0600, Joel Cunningham wrote:
> >>> On Dec 29, 2016, at 1:13 PM, Maxim Dounin <mdounin at mdounin.ru> wrote:
> > [...]
> >>> I agree though that if connection shortage is occasional the
> >>> current behaviour might not be optimal with worker_connections set
> >>> to a small value, or there are only a few connections can be
> >>> reused. Instead of gradually reducing keepalive (and post accept)
> >>> timeout to a smaller value it closes all keepalive connections
> >>> from time to time.
> >>> Probably optimal solution would be to close no more than some
> >>> fraction of reusable connections at once. Patch series below.
> >> I tested out the patch series and I did run into a problem.
> >> Looks like the reusable_connections_n increment and decrement
> >> are swapped. The first call to ngx_reusable_connection causes
> >> unsigned integer wrap around. I swapped the increment/decrement
> >> and the patch gives the expected behavior of only freeing 1/8
> >> (or at least 1) of the reusable connections.
> > Thanks for noticing this, fixed.
> Was your patch series going to be comitted? I didn’t see anything in the commit history yet
It is expected to be committed in a couple of days.
More information about the nginx-devel