5 messages in ru.sysoev.nginxRe: Unsure about proxy_temp_file_writ...
FromSent OnAttachments
Dave CheneyJan 28, 2008 7:27 pm 
Maxim DouninJan 29, 2008 3:24 am 
Dave CheneyJan 29, 2008 4:10 am 
Maxim DouninJan 29, 2008 5:43 am 
ThomasJul 4, 2008 1:03 pm 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: Unsure about proxy_temp_file_write_size to prevent upstream response bufferingActions...
From:Maxim Dounin (mdou@public.gmane.org)
Date:Jan 29, 2008 3:24:44 am
List:ru.sysoev.nginx

Hello!

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: 4.224.132.81, server: www.redbubble.com, request: "GET /people/redbubble/journal/206322-redbubble-post-card-everyones-an-artist HTTP/1.1", upstream: "http://172.16.0.72:8005/people/redbubble/journal/206322-redbubble-post-card-everyones-an-artist", host: "www.redbubble.com"

In this case the resource is

[dave@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.