How can I prevent Nginx from buffering the output of my uwsgi app? For my comet style application I'm using long polling and the requests are now buffered.
I tried to reduce the size of the buffers, but I'm not allowed to put uwsgi_buffer_size
and uwsgi_buffers
on 0. Also uwsgi_max_temp_file_size
does not work (eventhough the manual suggests that).
How can I do this?
Until a few minutes ago this was not possible. nginx would always buffer all uwsgi and scgi responses, and no configuration would change that.
I have submitted a patch for nginx (and it was accepted) and from the next version on there are two methods to disable buffering for uwsgi requests:
uwsgi_buffering off
in the nginx configX-Accel-Buffering
'no' header in the responseuwsgi never buffers the response, so no configuration is required on that end.
Why don't you use the uwsgi-embedded http-router/load-balancer directly ? It does no-buffering expecially for comet/websockets app. You can use nginx for static files mapping them to another domain.
Try with uwsgi_max_temp_file_size = 0
Nginx "proxy" module has a directive for that, it's called
proxy_buffering on|off
, which does exactly what you want, it turns buffering off and proxies upstream output synchronously. But AFAIK neither FastCGI nor UWSGI modules have it.BTW even when
proxy_buffering
isoff
, you may notice small delays because of OS TCP stack buffering.