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

姚伟斌 yaoweibin at gmail.com
Sun Jan 13 12:25:51 UTC 2013


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.

## fastcgi_request_buffering ##

Syntax: **fastcgi_request_buffering** `on | off`

Default: `on`

Context: `http, server, location`

The same as `proxy_request_buffering`.


2013/1/13 li zJay <zjay1987 at gmail.com>

> Hello!
>
> @yaoweibin
>
>> If you are eager for this feature, you could try my patch:
>> 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, 姚伟斌 <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:
>> https://github.com/taobao/tengine/pull/91. This patch has been running
>> in our production servers.
>>
>> 2013/1/11 li zJay <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
>>> nginx at nginx.org
>>> http://mailman.nginx.org/mailman/listinfo/nginx
>>>
>>
>>
>>
>> --
>> Weibin Yao
>> Developer @ Server Platform Team of Taobao
>>
>> _______________________________________________
>> 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/20130113/fa02a5f3/attachment.html>


More information about the nginx mailing list