Is it possible that nginx will not buffer the client body?

Weibin Yao yaoweibin at gmail.com
Fri Feb 22 02:06:11 UTC 2013


Use the patch I attached in this mail thread instead, don't use the pull
request patch which is for tengine.

Thanks.

2013/2/22 Pasi Kärkkäinen <pasik at iki.fi>

> On Fri, Jan 18, 2013 at 10:38:21AM +0200, Pasi Kärkkäinen wrote:
> > On Thu, Jan 17, 2013 at 11:15:58AM +0800, ?????? wrote:
> > >    Yes. It should work for any request method.
> > >
> >
> > Great, thanks, I'll let you know how it works for me. Probably in two
> weeks or so.
> >
>
> Hi,
>
> Adding the tengine pull request 91 on top of nginx 1.2.7 doesn't work:
>
> cc1: warnings being treated as errors
> src/http/ngx_http_request_body.c: In function
> 'ngx_http_read_non_buffered_client_request_body':
> src/http/ngx_http_request_body.c:506: error: implicit declaration of
> function 'ngx_http_top_input_body_filter'
> make[1]: *** [objs/src/http/ngx_http_request_body.o] Error 1
> make[1]: Leaving directory `/root/src/nginx/nginx-1.2.7'
> make: *** [build] Error 2
>
> ngx_http_top_input_body_filter() cannot be found from any .c/.h files..
> Which other patches should I apply?
>
> Perhaps this?
> https://github.com/cfsego/limit_upload_rate/blob/master/for-nginx.patch
>
>
> Thanks,
>
> -- Pasi
>
> >
> > >    2013/1/16 Pasi KÀrkkÀinen <[1]pasik at iki.fi>
> > >
> > >      On Sun, Jan 13, 2013 at 08:22:17PM +0800, ?????? wrote:
> > >      > Â  Â This patch should work between nginx-1.2.6 and nginx-1.3.8.
> > >      > Â  Â The documentation is here:
> > >
> > >      > Â  Â ## client_body_postpone_sending ##
> > >      > Â  Â Syntax: **client_body_postpone_sending** `size`
> > >      > Â  Â Default: 64k
> > >      > Â  Â Context: `http, server, location`
> > >      > Â  Â If you specify the `proxy_request_buffering` or
> > >      > Â  Â `fastcgi_request_buffering` to be off, Nginx will send the
> body
> > >      to backend
> > >      > Â  Â when it receives more than `size` data or the whole
> request body
> > >      has been
> > >      > Â  Â received. It could save the connection and reduce the IO
> number
> > >      with
> > >      > Â  Â backend.
> > >      >
> > >      > Â  Â ## proxy_request_buffering ##
> > >      > Â  Â Syntax: **proxy_request_buffering** `on | off`
> > >      > Â  Â Default: `on`
> > >      > Â  Â Context: `http, server, location`
> > >      > Â  Â Specify the request body will be buffered to the disk or
> not. If
> > >      it's off,
> > >      > Â  Â the request body will be stored in memory and sent to
> backend
> > >      after Nginx
> > >      > Â  Â receives more than `client_body_postpone_sending` data. It
> could
> > >      save the
> > >      > Â  Â disk IO with large request body.
> > >      >
> > >      >
> > >      > Â  Â  Â  Â  Â  Â  Note that, if you specify it to be off, the
> nginx
> > >      retry mechanism
> > >      > Â  Â with unsuccessful response will be broken after you sent
> part of
> > >      the
> > >      > Â  Â request to backend. It will just return 500 when it
> encounters
> > >      such
> > >      > Â  Â unsuccessful response. This directive also breaks these
> > >      variables:
> > >      > Â  Â $request_body, $request_body_file. You should not use these
> > >      variables any
> > >      > Â  Â more while their values are undefined.
> > >      >
> > >
> > >      Hello,
> > >
> > >      This patch sounds exactly like what I need aswell!
> > >      I assume it works for both POST and PUT requests?
> > >
> > >      Thanks,
> > >
> > >      -- Pasi
> > >
> > >      > Â  Â  Â Hello!
> > >      > Â  Â  Â @yaoweibin
> > >      >
> > >      > Â  Â  Â  Â If you are eager for this feature, you could try my
> > >      > Â  Â  Â  Â patch: [2][2]
> https://github.com/taobao/tengine/pull/91.
> > >      This patch has
> > >      > Â  Â  Â  Â been running in our production servers.
> > >      >
> > >      > Â  Â  Â what's the nginx version your patch based on?
> > >      > Â  Â  Â Thanks!
> > >      >      On Fri, Jan 11, 2013 at 5:17 PM, Ã*Å Ã*°±ó
> > >      <[3][3]yaoweibin at gmail.com> wrote:
> > >      >
> > >      > Â  Â  Â  Â I know nginx team are working on it. You can wait
> for it.
> > >      > Â  Â  Â  Â If you are eager for this feature, you could try my
> > >      > Â  Â  Â  Â patch: [4][4]
> https://github.com/taobao/tengine/pull/91.
> > >      This patch has
> > >      > Â  Â  Â  Â been running in our production servers.
> > >      >
> > >      > Â  Â  Â  Â 2013/1/11 li zJay <[5][5]zjay1987 at gmail.com>
> > >      >
> > >      > Â  Â  Â  Â  Â Hello!
> > >      > Â  Â  Â  Â  Â is it possible that nginx will not buffer the
> client
> > >      body before
> > >      > Â  Â  Â  Â  Â handle the request to upstream?
> > >      > Â  Â  Â  Â  Â we want to use nginx as a reverse proxy to upload
> very
> > >      very big file
> > >      > Â  Â  Â  Â  Â to the upstream, but the default behavior of
> nginx is to
> > >      save the
> > >      > Â  Â  Â  Â  Â whole request to the local disk first before
> handle it
> > >      to the
> > >      > Â  Â  Â  Â  Â upstream, which make the upstream impossible to
> process
> > >      the file on
> > >      > Â  Â  Â  Â  Â the fly when the file is uploading, results in
> much high
> > >      request
> > >      > Â  Â  Â  Â  Â latency and server-side resource consumption.
> > >      > Â  Â  Â  Â  Â Thanks!
> > >      > Â  Â  Â  Â  Â _______________________________________________
> > >      > Â  Â  Â  Â  Â nginx mailing list
> > >      > Â  Â  Â  Â  Â [6][6]nginx at nginx.org
> > >      > Â  Â  Â  Â  Â [7][7]
> http://mailman.nginx.org/mailman/listinfo/nginx
> > >      >
> > >      > Â  Â  Â  Â --
> > >      > Â  Â  Â  Â Weibin Yao
> > >      > Â  Â  Â  Â Developer @ Server Platform Team of Taobao
> > >      > Â  Â  Â  Â _______________________________________________
> > >      > Â  Â  Â  Â nginx mailing list
> > >      > Â  Â  Â  Â [8][8]nginx at nginx.org
> > >      > Â  Â  Â  Â [9][9]
> http://mailman.nginx.org/mailman/listinfo/nginx
> > >      >
> > >      > Â  Â  Â _______________________________________________
> > >      > Â  Â  Â nginx mailing list
> > >      > Â  Â  Â [10][10]nginx at nginx.org
> > >      > Â  Â  Â [11][11]http://mailman.nginx.org/mailman/listinfo/nginx
> > >      >
> > >      > Â  Â --
> > >      > Â  Â Weibin Yao
> > >      > Â  Â Developer @ Server Platform Team of Taobao
> > >      >
> > >      > References
> > >      >
> > >      > Â  Â Visible links
> > >      > Â  Â 1. mailto:[12]zjay1987 at gmail.com
> > >      > Â  Â 2. [13]https://github.com/taobao/tengine/pull/91
> > >      > Â  Â 3. mailto:[14]yaoweibin at gmail.com
> > >      > Â  Â 4. [15]https://github.com/taobao/tengine/pull/91
> > >      > Â  Â 5. mailto:[16]zjay1987 at gmail.com
> > >      > Â  Â 6. mailto:[17]nginx at nginx.org
> > >      > Â  Â 7. [18]http://mailman.nginx.org/mailman/listinfo/nginx
> > >      > Â  Â 8. mailto:[19]nginx at nginx.org
> > >      > Â  Â 9. [20]http://mailman.nginx.org/mailman/listinfo/nginx
> > >      > Â  10. mailto:[21]nginx at nginx.org
> > >      > Â  11. [22]http://mailman.nginx.org/mailman/listinfo/nginx
> > >
> > >      > _______________________________________________
> > >      > nginx mailing list
> > >      > [23]nginx at nginx.org
> > >      > [24]http://mailman.nginx.org/mailman/listinfo/nginx
> > >
> > >      _______________________________________________
> > >      nginx mailing list
> > >      [25]nginx at nginx.org
> > >      [26]http://mailman.nginx.org/mailman/listinfo/nginx
> > >
> > >    --
> > >    Weibin Yao
> > >    Developer @ Server Platform Team of Taobao
> > >
> > > References
> > >
> > >    Visible links
> > >    1. mailto:pasik at iki.fi
> > >    2. https://github.com/taobao/tengine/pull/91
> > >    3. mailto:yaoweibin at gmail.com
> > >    4. https://github.com/taobao/tengine/pull/91
> > >    5. mailto:zjay1987 at gmail.com
> > >    6. mailto:nginx at nginx.org
> > >    7. http://mailman.nginx.org/mailman/listinfo/nginx
> > >    8. mailto:nginx at nginx.org
> > >    9. http://mailman.nginx.org/mailman/listinfo/nginx
> > >   10. mailto:nginx at nginx.org
> > >   11. http://mailman.nginx.org/mailman/listinfo/nginx
> > >   12. mailto:zjay1987 at gmail.com
> > >   13. https://github.com/taobao/tengine/pull/91
> > >   14. mailto:yaoweibin at gmail.com
> > >   15. https://github.com/taobao/tengine/pull/91
> > >   16. mailto:zjay1987 at gmail.com
> > >   17. mailto:nginx at nginx.org
> > >   18. http://mailman.nginx.org/mailman/listinfo/nginx
> > >   19. mailto:nginx at nginx.org
> > >   20. http://mailman.nginx.org/mailman/listinfo/nginx
> > >   21. mailto:nginx at nginx.org
> > >   22. http://mailman.nginx.org/mailman/listinfo/nginx
> > >   23. mailto:nginx at nginx.org
> > >   24. http://mailman.nginx.org/mailman/listinfo/nginx
> > >   25. mailto:nginx at nginx.org
> > >   26. http://mailman.nginx.org/mailman/listinfo/nginx
> >
> > > _______________________________________________
> > > nginx mailing list
> > > nginx at nginx.org
> > > http://mailman.nginx.org/mailman/listinfo/nginx
> >
> > _______________________________________________
> > nginx mailing list
> > nginx at nginx.org
> > http://mailman.nginx.org/mailman/listinfo/nginx
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>



-- 
Weibin Yao
Developer @ Server Platform Team of Taobao
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20130222/39af330d/attachment-0001.html>


More information about the nginx mailing list