# Ideal setting of "fastcgi\_buffers" with large files

**URL:** <https://www.ruby-forum.com/t/ideal-setting-of-fastcgi-buffers-with-large-files/169597>\
**Category:** NGINX\
**Created:** [June 5, 2009, 7:20pm UTC](https://www.ruby-forum.com/t/ideal-setting-of-fastcgi-buffers-with-large-files/169597 "2009-06-05T19:20:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![w3wsrmn](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/b38774/32.png) [@w3wsrmn](https://www.ruby-forum.com/u/w3wsrmn)\
**Post date:** [June 5, 2009, 7:20pm UTC](https://www.ruby-forum.com/t/ideal-setting-of-fastcgi-buffers-with-large-files/169597/1 "2009-06-05T19:20:20Z")

</div>

Howdy,

For cases when large files are served via FastCGI, what might be the  
ideal settings for the “fastcgi\_buffers” directive, in order to prevent  
the warning:  
“an upstream response is buffered to a temporary file  
/usr/local/nginx/fastcgi\_temp/0/00/0000000000 while reading upstream” ?

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

A large number of small buffers:  
fastcgi\_buffers 768 8k

A small number of large buffers:  
fastcgi\_buffers 8 768k

A near balance between the buffers and size:  
fastcgi\_buffers 64 96k

Or does it not matter which method is used?

Thanks for the help!

Posted at Nginx Forum:

> **[Ideal setting of "fastcgi\_buffers" with large files](https://forum.nginx.org/read.php?2,2649,2649#msg-2649)**
>
> Howdy, For cases when large files are served via FastCGI, what might be the ideal settings for the "fastcgi\_buffers" directive, in order to prevent the warning: "an upstream response is buffered to a temporary file...

---

<div class="post-metadata">

**Author:** ![w3wsrmn](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/b38774/32.png) [@w3wsrmn](https://www.ruby-forum.com/u/w3wsrmn)\
**Post date:** [November 25, 2009, 8:03am UTC](https://www.ruby-forum.com/t/ideal-setting-of-fastcgi-buffers-with-large-files/169597/2 "2009-11-25T08:03:17Z")

</div>

## w3wsrmn Wrote:

> Or does it not matter which method is used?
> 
> Thanks for the help!

Did you get any answer for above question?  
Would like to know!

Thanks,  
-Rahul

Posted at Nginx Forum:  
[http://forum.nginx.org/read.php?2,2649,25430#msg-25430](http://forum.nginx.org/read.php?2,2649,25430#msg-25430)

---

<div class="post-metadata">

**Author:** ![w3wsrmn](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/b38774/32.png) [@w3wsrmn](https://www.ruby-forum.com/u/w3wsrmn)\
**Post date:** [December 3, 2009, 9:40am UTC](https://www.ruby-forum.com/t/ideal-setting-of-fastcgi-buffers-with-large-files/169597/3 "2009-12-03T09:40:46Z")

</div>

w3wsrmn wrote:

> A small number of large buffers:  
> fastcgi\_buffers 8 768k
> 
> A near balance between the buffers and size:  
> fastcgi\_buffers 64 96k
> 
> Or does it not matter which method is used?  
> It would be better to tell nginx to serve the file rather than have an  
> upstream/fastcgi program serve it - nginx can generally handle many,  
> many more connections than your fast-cgi backend so try and make nginx  
> do as much of the work as possible.

Take a look at: [GitHub - nginxinc/nginx-wiki: ARCHIVED -- Source for the now archived NGINX Wiki section of https://www.nginx.com · GitHub](http://wiki.nginx.org/NginxXSendfile) - using this means  
your PHP/fast-cgi thread can exit once it’s returned the header and then  
move on to accept another connection.

–

_Phillip B Oldham_  
ActivityHQ  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) [mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

* * *

_Policies_

This e-mail and its attachments are intended for the above named  
recipient(s) only and may be confidential. If they have come to you in  
error, please reply to this e-mail and highlight the error. No action  
should be taken regarding content, nor must you copy or show them to  
anyone.

This e-mail has been created in the knowledge that Internet e-mail is  
not a 100% secure communications medium, and we have taken steps to  
ensure that this e-mail and attachments are free from any virus. We must  
advise that in keeping with good computing practice the recipient should  
ensure they are completely virus free, and that you understand and  
observe the lack of security when e-mailing us.
