How to disable buffering when using FastCGI?

Denis F. Latypoff denis at gostats.ru
Tue Oct 13 18:45:33 MSD 2009


Hello Nicolas,

Tuesday, October 13, 2009, 9:20:00 PM, you wrote:

> On Tue, Oct 13, 2009 at 13:19, Maxim Dounin <mdounin at mdounin.ru> wrote:
>> On Tue, Oct 13, 2009 at 12:17:05PM +0200, Nicolas Grilly wrote:
>>
>>> Is there a way to disable buffering when using FastCGI? (for a Comet
>>> style application)
>>>
>>> Is there an option "fastcgi_buffering off", working like the option
>>> "proxy_buffering off" in the HTTP proxy module?
>>
>> No, there is no such option.  Buffering can't be disabled for
>> fastcgi.

> Hello Maxim,

> Is there no such option just because nobody implemented it? Or is it
> because of some kind of technical constraint?

Yes. It's because of FastCGI protocol internals. It splits "stream"
into blocks max 32KB each. Each block has header info (how many bytes
it contains, etc). So nginx can't send content to the client until it
get the whole block from upstream.

> Do you recommend to people developing Comet style application to use
> HTTP proxying instead of FastCGI?

Yes. Nginx can establish pipe between backend and client just after
headers are sent in case when proxy_buffering = off and gzip = off.

> Is it difficult to implement the option "fastcgi_buffering off", using
> the same technique as in the source code of module HTTP proxy?

It is not possible. See comment above.

> Thanks for your advice,

> Nicolas Grilly


-- 
Best regards,
 Denis                            mailto:denis at gostats.ru






More information about the nginx mailing list