目录

关于 nginx proxy_buffering 的作用

Without buffers, data is sent from the proxied server and immediately begins to be transmitted to the client. If the clients are assumed to be fast, buffering can be turned off in order to get the data to the client as soon as possible. With buffers, the Nginx proxy will temporarily store the backend’s response and then feed this data to the client. If the client is slow, this allows the Nginx server to close the connection to the backend sooner. It can then handle distributing the data to the client at whatever pace is possible.


其实它的作用就是早点关闭后端链接,减轻后端服务器负担,然后自己完成后面的数据传输工作


关闭 proxy_buffering 网站的TTFB会有一个比较明显的提升

开启proxy_buffering 必须 填满缓冲或者后端数据读完才会发送给客户端,如果后端数据比较小,而且是长链接,则需要等长链接的下一次心跳才会发送数据(比如java web os.flush())