[Web-SIG] WSGI and start_response

Graham Dumpleton graham.dumpleton at gmail.com
Sat Apr 10 13:20:36 CEST 2010


On 9 April 2010 07:53, P.J. Eby <pje at telecommunity.com> wrote:
>> Also, note that with Nginx (as with Apache, if I'm not wrong), even if
>> application yields small strings, the server can still do some buffering
>> in order to increase performance.
>
> In which case, it's in violation of the WSGI spec.  The spec requires
> eparately-yielded strings to be flushed to OS-level buffering.

True, and Apache/mod_wsgi does best effort on that.

Output filters at Apache level can be a problem with that though as a
flush bucket in Apache bucket chains is a request only and an output
filter can decide not to flush through all data. For example,
mod_deflate may buffer partial data in order to get enough for next
block of compressed data.

This is the exception rather than the norm, and if no such output
filters exists, then separately yield strings should be flushed right
through to the socket.

So, one can try and satisfy that requirement in WSGI, but in practice
it cannot always be achieved because you may have absolutely no
control over the underlying web server.

Graham


More information about the Web-SIG mailing list