[ANNOUNCE] ngx_http_upstream_keepalive
Maxim Dounin
mdounin at mdounin.ru
Fri Oct 24 22:12:51 MSD 2008
Hello!
On Fri, Oct 24, 2008 at 07:28:10PM +0200, Grzegorz Nosek wrote:
> On pią, paź 24, 2008 at 08:56:28 +0400, Maxim Dounin wrote:
> > Request to upstream is created in ngx_http_proxy_module, so no
> > filters there.
>
> Right. But it was worth asking ;)
>
> > You may try to use proxy_set_header though, and then use
> > proxy_hide_header to filter out Keep-Alive header from the
> > response. It may even work - if backend handle HTTP/1.0 keepalive
> > connections and won't try to sent chunked encoding to nginx.
>
> That was my idea too but I thought about encapsulating it somehow so
> that the keepalive support would be transparent.
BTW, this anyway won't work without connection close patches I've
posted a while ago.
[...]
> > For FastCGI it should be as simple as not setting appropriate close
> > bit in request created by ngx_http_fastcgi_module (and using my
> > patches for connection closing), but I've not checked it yet.
>
> I think keepalive support would fit best in Nginx core (not as an
> external module) with some infrastructure to support it.
I've did it in separate module since it's much more managable to
have this code in separate file. It's in Igor hands to
incorporate this module into nginx core if he decides to.
And actually there are unfinished keepalive code in rr balancer
(and I actually have this code finished and working here),
but it doesn't look like good direction to me - since there are
other balancers, and they need keepalive too.
> Consumers of
> the upstream functionality (memcached, fastcgi, proxy) could provide a
> "want keepalive" flag which would mean that they are aware of keepalive
> and handle it at the protocol level.
>
> As Nginx is as much a proxy as it is a web server, maybe it makes sense
> to make the upstream layer stackable, like:
The keepalive module is an example that demonstrates that upstream
layer *is* stackable.
Maxim Dounin
More information about the nginx
mailing list