I'm working on a configuration for a reverse proxy that's only purpose is to load balance requests between two upstream servers, primarily for redundancy in case one goes down.
I'm curious about the affect of proxy_buffering
, described here.
I'm load balancing requests for large video files, where the largest and most commonly requested "chunk" of a video is around 2.5 Megabytes. Our CDN makes requests for these videos using byte-rages. The video files are much larger than that.
The default for proxy_buffering
is that it's enabled. My questions are:
- What is the benefit for nginx buffering the response from the proxied server? It must have some value if (a) it's an option and (b) it's turned on by default.
- Does it make sense to disable it in my case? Where the requested data is typically quite large?
Best Answer
I think
proxy_buffering
is only useful in some cases. For example it avoids keeping a connection open between nginx and upstream when the connection between nginx and the client is slow.However, I'm not sure turning it off would significantly improve performance, even in your case.
A less radical change than disabling
proxy_buffering
could be settingproxy_max_temp_file_size 0
to make sure performance doesn't get hurt by disk IO.