Tweaking fastcgi-buffers

Following can help you tweak fastcgi_buffers size & numbers.

Maximum Response Size

awk '($9 ~ /200/)' access.log  | awk '{print $10}' | sort -nr | head -n 1

Please note we taking HTTP 200 OK response only into consideration.

Average Response Size

echo $(( `awk '($9 ~ /200/)' access.log | awk '{print $10}' | awk '{s+=$1} END {print s}'` / `awk '($9 ~ /200/)' access.log  | wc -l` ))

Based on above result, for rtCamp.com we found following values:

Avg. 24807
Max. 629622

So we are using:

fastcgi_buffers 32 32k;
fastcgi_buffer_size 32k;

Related: Nginx Log Parsing Examples