| Syntax: | fastcgi_buffers number size |
| Default: | 8 4k|8k |
| Context: | http server location |
| Reference: | fastcgi_buffers |
This directive sets the number and the size of the buffers into which the reply from the FastCGI process in the backend is read.
fastcgi_buffers should be set to the typical fastcgi response size. You should handle most of responses in memory while the biggest responses are buffered to disk.
If you want to disable buffering to disk for all replies that are greater than the FastCGI buffers and transfer data synchronously to the client set fastcgi_max_temp_file_size to 0.
The fastcgi_buffer is equivalent to: fastcgi_buffer_size + the_number * is_size
If a fastcgi 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. After fastcgi_buffer_size has been emptied, it used together with fastcgi_buffers.
Example:
fastcgi_buffers 256 4k; # Sets the buffer size to 4k + 256 * 4k = 1028k
This means that any reply by the FastCGI process in the backend greater than 1M goes to disk. Only replies below 1M are handled directly in memory.
By default, the size of each buffer is equal to the OS page size. Depending on the platform and architecture this value is one of 4k, 8k or 16k.
On Linux you can get the page size issuing:
getconf PAGESIZE
it returns the page size in bytes.