Unsure about proxy_temp_file_write_size to prevent upstream response buffering
mdounin at mdounin.ru
Tue Jan 29 14:25:07 MSK 2008
On Tue, Jan 29, 2008 at 02:27:47PM +1100, Dave Cheney wrote:
> For large dynamic responses generated by our application occasionally they
> are being buffered to disk
> 2008/01/29 14:21:13 [warn] 19297#0: *12289266 an upstream response is
> buffered to a temporary file
> /opt/local/var/run/nginx/proxy_temp/3/50/0000123503 while reading upstream,
> client: 22.214.171.124, server: www.redbubble.com, request: "GET
> HTTP/1.1", upstream:
> host: "www.redbubble.com"
> In this case the resource is
> [dave at crimson ~]$ curl -I http://www.redbubble.com/people/redbubble/journal/206322-redbubble-post-card-everyones-an-artist
> HTTP/1.1 200 OK
> Server: nginx
> Date: Tue, 29 Jan 2008 03:22:08 GMT
> Content-Type: text/html; charset=utf-8
> Connection: keep-alive
> Set-Cookie: _session_id=223812df7b7e519d8ca3b2a6540b7016; path=/
> Cache-Control: private, max-age=0, must-revalidate
> Content-Length: 73827
> 73827 bytes long (before compression)
> I have
> proxy_temp_file_write_size 128k
> set to 128k, which I thought would buffer up to 128k of data in memory
> before writing it to disk.
You should configure proxy_buffer_size / proxy_buffers large enough instead.
Directive proxy_temp_file_write_size basically tells nginx how
many data it can flush to disk at once when writing temporary
file. It may be used to prevent nginx worker process from blocking
for too long in io path.
More information about the nginx