SOS! Why Nginx DID NOT flush buffer to client?

Tobia Conforto tobia.conforto at
Thu Feb 11 12:18:02 MSK 2010

21andy wrote:
> I want to the php file output 1 line per second.

I know it's not an answer to your question, but you should re-evaluate your application architecture. If you need progress report on lengthy operations you can use separate batch processes, messaging queues, databases, Ajax, and all sorts of tools.

The reason nginx buffers all output is because, most of the times, generating the response is a much faster operation than transferring it to the client. Therefore, by buffering it, nginx frees the backend worker (the php child process) sooner and the system is able to serve more requests per unit of time, for a given amount of ram. Which is one of the main aims of server optimization.

Hope this explains the logic behind it.


More information about the nginx mailing list