Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I just moved our blog-network to ngnix (from apache) which is powered by WPMU. Everything is running smoothly and fine.

During my quest to optimize server to the max level - I came across this thread on nginx forum http://forum.nginx.org/read.php?2,2649

I would really like to know: Answer to the original question...

For example, to prevent the warning when serving a 6144 kilobyte file, which of the three methods would yield the best performance?

  1. A large number of small buffers: fastcgi_buffers 768 8k
  2. A small number of large buffers: fastcgi_buffers 8 768k
  3. A near balance between the buffers and size: fastcgi_buffers 64 96k

And also one more thing: In my ngnix.config - my setting is:

fastcgi_buffers 64 4k;

i.e. 256K buffer size (I am on 32-bit platform). Does this mean if my PHP scripts generates response larger than 256K, nginx will throw some error?

I know ngnix forum seems better place to ask this but as no ngnix forum is more active than serverfault, I'm posting this question here.

I hope I will get some inputs/guidance from experts here.

Thanks,

-Rahul

share|improve this question

1 Answer 1

up vote 3 down vote accepted

No, it means that if your scripts often generate less than 256K responses - the buffer will often be half-empty, and you just waste the memory :)

Beffer works like this: nginx reads min(buffer_size,response_size) bytes from FCGI script, sends it to a client and empties the buffer's contents. If there's more responce data - it reads & sends again.

If your site often provides small script-generated pages, the optimal value is a bit more than the size of a typical script responce size: headers + contents.

share|improve this answer
    
Thanks. It really gives me useful hints. Now I guess warnings i.e. [warn] lines, we see in ngnix error_log regarding FCGI buffer are generated when ngnix does read & send again multiple times. Can it be safely ignored? Also if possible please answer my first question too. Thanks. :-) –  rahul286 Nov 26 '09 at 7:07
    
The warning means nginx tried to fetch the whole response and it did not fit into the buffer. This is not good unless happens not so frequent: disk is slow, you should avoid using it instead of buffering. –  kolypto Nov 26 '09 at 13:00
    
Thanks. I got answer to this from Igor (creator of nginx) himself as well. You further made it clear to me. :-) –  rahul286 Nov 29 '09 at 12:43

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.