Tuesday 17 December 2013

Buffering

Today I was doing more website stuff. I decided to look into fixing the an upstream response is buffered to a temporary file nginx warnings I was seeing in my logs. However, after doing some research, I couldn't really see whether the recommendation was to increase fastcgi_buffers size or switch fastcgi_buffering off. I would have thought that turning buffering off should be preferable, as then the client can start receiving the page ASAP rather than having to wait for the backend to finish processing the request. But most discussions were just about setting an optimum buffer size.

So I'm guessing that keeping fastcgi buffering and setting a good average buffer size is probably the recommended route. When I ran a request that buffered to file on the server on my local machine, I didn't get any buffering warning. So that makes the issue a bit more difficult to check the best buffer size and that it is working properly.

When looking at my config to try and see if I currently had any buffer statements in place, I found that I had client_body_buffer_size 2056k;. I'm not sure why I had that set, so I'm going to remove it for the moment.

After I looked into how many requests were giving a warning about being buffered to a temporary file, I decided not to change the the fastcgi_buffer settings, and just leave them at their default values. The error logs had a much smaller amount of lines than the access logs, so I think the vast majority of requests aren't being buffered to disk. (A very scientific way to check, I know.)

No comments: