upstream keepalive: call for testing

Maxim Dounin mdounin at
Sat Jul 30 21:03:04 UTC 2011


On Sat, Jul 30, 2011 at 07:46:34PM +0200, Srebrenko Šehić wrote:

> On Tue, Jul 26, 2011 at 1:57 PM, Maxim Dounin <mdounin at> wrote:
> Hi,
> > Attached patch (against 1.0.5) introduces upstream keepalive
> > support for memcached, fastcgi and http.  Note the patch is
> > experimental and may have problems (though it passes basic smoke
> > tests here).  Testing is appreciated.
> How "intrusive" is this patch if keepalive is 0? Ie. will this patch
> negatively effect the way nginx works if keepalive is not used?

I've tried to keep negative effects minimal.  And actually there 
are some improvements, see below.

For memcached it basically not changes anything.

For proxy it slightly improves things if chunked encoding is not 
used (nginx will no longer wait for connection close from backend 
if response length is known).

If chunked encoding is used (should only happen if you set 
proxy_http_version to 1.1, but actually happens even with 1.0 in 
wild, so we have to support it anyway) - proxy buffer utilization 
may not be ideal if backend uses multiple small chunks, but I 
don't expect this to be major issue.

For fastcgi (much like proxy chunked), buffering is no longer 
ideal.  On the other hand, it's now possible to actually flush 
responses from fastcgi application.

Another thing which may require attention is that fastcgi with the 
patch uses FCGI_KEEP_CONN flag by default.  As a result 
connections won't be closed by fastcgi application but by nginx, 
and hence TIME_WAIT sockets will be on nginx side instead of 
application side.  This may require additional tuning if remote 
fastcgi backends are used.

Maxim Dounin

More information about the nginx-devel mailing list