0

Nginx keeps logging below message on my error log

[warn] 16387#16387: *1117 an upstream response is buffered to a temporary file /var/cache/nginx/fastcgi_temp/1/32/0000000321 while reading upstream, client: 173.245.54.175, server:

this fills up my log files , i want to disable buffering completely ,

i've tried turning proxy_buffering proxy_buffering off; but the logs keeps showing that nginx/fastcgi is buffering responses

How do i turn off buffering all together ?

salimsaid
  • 101
  • 3
  • Please add output of `nginx -T` into your question. – Tero Kilkanen Oct 17 '20 at 07:54
  • You can turn it off using the approach in the linked post, but this will dramatically reduce your performance. Rather, you should [increase the size of the buffer](https://serverfault.com/a/511790/126632) so that temporary files are written to disk less often. – Michael Hampton Oct 17 '20 at 12:07

1 Answers1

1

i want to disable buffering completely

Technically, you shouldn't be doing it in most of the cases. Buffering is required for things like FastCGI caching, and more importantly, allows asynchronously fetching data from upstream, thus keeping your backend (often heavy on RAM usage), free, while slow clients are fetching data.

Adjust your buffers instead in order to get rid of the warning message, in a way that entire upstream response can be fit into memory.

With proxy buffering truly off, you negate NGINX, and turn it into something that is worse than Apache+PHP-FPM (because everything is synchronous, and further slow, because of NGINX vs PHP-FPM communication)

Danila Vershinin
  • 5,286
  • 5
  • 17
  • 21