How to disable buffering when using FastCGI?

Maxim Dounin mdounin at
Tue Oct 13 23:43:23 MSD 2009


On Tue, Oct 13, 2009 at 08:24:53PM +0200, Nicolas Grilly wrote:


> >> Is it difficult to implement the option "fastcgi_buffering off", using
> >> the same technique as in the source code of module HTTP proxy?
> >
> > Current "proxy_buffering off" implementation is something wierd
> > and should be nuked, IMHO.  The same implementation for FastCGI
> > just won't work.
> >
> > I believe buffering control in upstream module (which includes
> > fastcgi, proxy and memcached) should be changed to something more
> > flexible.  In particular, fastcgi should be aware of FastCGI
> > record boundaries, and shouldn't try to buffer too much as long as
> > it got full record.
> >
> > I've posted some preliminary patches for this as a part of backend
> > keepalive support work, but they are a bit stale now.
> It would be a perfect solution! If the fastcgi module is aware of
> FastCGI record boundaries and stops buffering after having received a
> full record, then the problem is solved. This gives to the FastCGI
> backend complete control over the amount of buffering, sending short
> records in order to limit buffering, or sending long records (around
> 8KB) for normal buffering. Is it your plan for the future of the
> upstream module?

Complete control isn't really good thing, as it limits the ability 
to optimize brain-damaged backends.  But as long as fastcgi 
finished record and not started another one - it's probably a good 
idea to pass data we got so far downstream.  And current aproach 
won't work with keepalive connections anyway.

But please keep in mind that I'm not Igor.

Maxim Dounin

More information about the nginx mailing list