August 04, 2011 06:40AM
(This is my first message to this list, please let me know if I'm
doing something wrong!)

In developing a comet style application in a uwsgi/nginx setup I
noticed that nginx always buffers the response when uwsgi_pass is
used.

I'm not sure or there is any particular reason why this is done,
except for the fact that the uwsgi code is originally based on the
fastcgi module where indeed buffering is unavoidable. I think however
that it makes sense to give the option of disabling buffering with
uwsgi.

I actually already went ahead and wrote a patch that does exactly
this. It introduces a uwsgi_buffering flag and now adheres to the
"X-Accel-Buffering" header. I have only limited capabilities to test
this patch, but for me it does exactly that, disabling the buffer.

Could some of you review this patch and if it is ok, could it be
introduced in nginx?

I made the patch on the 1.1.0 source. I attached it and included it
inline below this message. Let me know if I should give it in a
different format.

Regards,

Peter Smit



--- nginx-1.1.0/src/http/modules/ngx_http_uwsgi_module.c 2011-07-29
18:33:03.000000000 +0300
+++ nginx-1.1.0-uwsgi_buffering/src/http/modules/ngx_http_uwsgi_module.c 2011-08-04
13:16:54.381528459 +0300
@@ -123,6 +123,13 @@
offsetof(ngx_http_uwsgi_loc_conf_t, upstream.store_access),
NULL },

+ { ngx_string("uwsgi_buffering"),
+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE123,
+ ngx_conf_set_flag_slot,
+ NGX_HTTP_LOC_CONF_OFFSET,
+ offsetof(ngx_http_uwsgi_loc_conf_t, upstream.buffering),
+ NULL },
+
{ ngx_string("uwsgi_ignore_client_abort"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
ngx_conf_set_flag_slot,
@@ -445,7 +452,7 @@
u->abort_request = ngx_http_uwsgi_abort_request;
u->finalize_request = ngx_http_uwsgi_finalize_request;

- u->buffering = 1;
+ u->buffering = uwcf->upstream.buffering;

u->pipe = ngx_pcalloc(r->pool, sizeof(ngx_event_pipe_t));
if (u->pipe == NULL) {
@@ -1083,6 +1090,8 @@
/* "uwsgi_cyclic_temp_file" is disabled */
conf->upstream.cyclic_temp_file = 0;

+ conf->upstream.change_buffering = 1;
+
ngx_str_set(&conf->upstream.module, "uwsgi");

return conf;
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

Option to disable buffering in uwsgi module Attachments

Peter Smit 3953 August 04, 2011 06:40AM

Re: Option to disable buffering in uwsgi module

Igor Sysoev 1480 August 04, 2011 06:46AM

Re: Option to disable buffering in uwsgi module Attachments

Peter Smit 1003 September 23, 2011 02:26AM

Re: Option to disable buffering in uwsgi module

Maxim Dounin 1019 September 23, 2011 06:32AM

Re: Option to disable buffering in uwsgi module

Peter Smit 1111 September 23, 2011 06:52AM

Re: Option to disable buffering in uwsgi module

Maxim Dounin 1031 September 23, 2011 07:08AM

Re: Option to disable buffering in uwsgi module

Peter Smit 951 September 30, 2011 04:08AM

[PATCH] Option to disable buffering in uwsgi module

Peter Smit 1136 September 30, 2011 06:02AM

Re: [PATCH] Option to disable buffering in uwsgi module

Maxim Dounin 977 September 30, 2011 06:18AM

Re: [PATCH] Option to disable buffering in uwsgi module

Peter Smit 1129 September 30, 2011 06:22AM

Re: [PATCH] Option to disable buffering in uwsgi module

Maxim Dounin 1205 September 30, 2011 08:04AM

Re: Option to disable buffering in uwsgi module

Maxim Dounin 1151 September 30, 2011 06:06AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 115
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready