Tweaking FastCGI buffers settings
rahul286
nginx-forum at nginx.us
Thu Nov 26 17:19:28 MSK 2009
Thanks Igor for personally responding to my query and of-course for ngnix :-)
Now I have few more questions...
>> In my ngnix.conf - inside php-fastcgi handler block I have settings...
>> fastcgi_buffers 64 4k;
>> i.e. 256K buffer size (I am on 32-bit platform). This means that if php scripts generate more than 256K size responses nginx will read first 256K sends it to a client and empties the buffer's contents. If there's more responce data - it reads & sends again.
>> At this point when ngnix performs multiple reads does it writes to the error_log a line like an "upstream response is buffered to a temporary file /var/lib/nginx/fastcgi/"
> This depends on typical repsonse size.
So there is no way to avoid this warning - "upstream response is buffered to a temporary file /var/lib/nginx/fastcgi/" ??
Since no matter how large buffer we set, this will exceed at some point as in my case I am serving images and other "files" through PHP using readfile() function.
> If a response is 12k then "fastcgi_buffers 64 4k" will allocated 3 buffers of 4k.
> This is why fastcgi_buffers has two parameters, while fastcgi_buffer_size (used for response header and first part) has just one paramter.
> BTW, after fastcgi_buffer_size has been emptied, it used together with fastcgi_buffers.
Based on above info - if my average response size is 128K and max response size is 32M and I'm on 32-bit platform,
then following must be most optimized configuration - It will use memory efficiently as well as will not generate any warning?
fastcgi_buffer_size 128K
fastcgi_buffers 8192 4k
Am I right?
Posted at Nginx Forum: http://forum.nginx.org/read.php?2,25728,25803#msg-25803
More information about the nginx
mailing list