Tweaking FastCGI buffers settings
rahul286
nginx-forum at nginx.us
Thu Nov 26 11:14:48 MSK 2009
First let me show my understanding of ngnix working till now...
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/"
Is this something to worry about?
As ngnix uses a function like below to allocate memory while sending PHP script response to client
min(buffer_size,response_size)
If site often provides small script-generated response, large buffer_size will waste a lot of memory.
But using large fastcgi_buffers removed warning "upstream response is buffered to a temporary file /var/lib/nginx/fastcgi/" from error_logs.
I really lots of free RAM but I wanted to allocated buffers in most optimized way and use rest of my free RAM to start more php-cgi child processes (I think it will help me handle more traffic bursts)
Any inputs on this greatly appreciated.
Thanks,
-Rahul
Posted at Nginx Forum: http://forum.nginx.org/read.php?2,25728,25728#msg-25728
More information about the nginx
mailing list