question about proxy_buffers

merlin corey merlincorey at dc949.org
Fri Jun 12 02:07:26 MSD 2009


2009/6/11 Jérôme Loyet <jerome at loyet.net>:
> 2009/6/10 merlin corey <merlincorey at dc949.org>:
>> I'm not Igor so I cannot be totally sure, but my understanding of it
>> has always been 1- requests to the backend can use only one buffer and
>> the response gets buffered to disk.  As such, I generally start out
>> sites with log level info (might be too low) and try to tune down
>> requests getting buffered if at all possible.  I also try to stick
>> with magic numbers good for the architecture (so 8 and 16 based,
>> generally).
>>
> Thx for the answer merlin,
>
> I did some test. The request I make to nginx is proxied to the
> backend. There is only one request made at the same time.
> I request a 5Mo file.
>
> First: with minimum buffers:
> proxy_buffers 2 4k;
>
> I have this in the log: 2009/06/11 19:40:05 [warn] 24607#0: *104 an
> upstream response is buffered to a temporary file
> /LIBRE/nginx/proxy_temp/0000000000 while reading upstream, ....
>
> Then I set 10 buffers of 1Mo:
> proxy_buffers 10 1m;
> and nothing appears in logs.
>
> This tells me that a request can use more than one buffer.
>
> I'll set up small buffers but a large number:
> proxy_buffers 2048 8k;
>
> Is it too much ?
>
>>
>> 2009/6/9 Jérôme Loyet <jerome at loyet.net>:
>>> Hi all,
>>>
>>> I'm not sure how proxy_buffers are used.
>>>
>>> 1- requests to the backend can use only one buffer. If the reponse is
>>> bigger than one buffer, some part of the response is buffered to disk.
>>> 2- requests to the backen can use multiple buffers. If the response is
>>> bigger than on buffer, nginx will use more buffers (if available of
>>> course).
>>>
>>> So depending on the answer, I would use :
>>> 1- big buffers so that 80% of the requests can feet in on buffer. And
>>> enough buffers so that 80% of the requests can be buffered
>>> 2- small buffers and a lots of buffers
>>>
>>> don't know what to use :) any clue ?
>>>
>>> thx
>>> ++ jerome
>>>
>>>
>>
>>
>
>

Nice work!  I guess for figuring out if it is too much you need to
look at your system and determine if it will be using too much memory,
but I would bet you can easily handle the 16MB + whatever structure
overhead for those 2048 buffers.  Possibly other factors like paging
and caching (on CPU level) might come into play, too, but probably not
at our (human) granuality.





More information about the nginx mailing list