我知道Nginx可以缓冲来自上游服务器的响应.
I know Nginx could buffer response from upstream server.
我的问题是,Nginx是否还会缓冲来自客户端的http请求?我的意思是,如果Nginx从客户端收到http请求,它是否立即与上游服务器建立连接?还是会在收到整个http请求后创建连接?
My question is, does Nginx also buffer http request from client? I mean, if Nginx get a http request from client, does it create connection with upstream server immediatly? Or it will create connection after it get a whole http request?
许多应用服务器框架都使用工作线程池模型.如果客户端计算机速度较慢或远离Nginx和上游服务器,而没有在Nginx端缓冲http请求,则上游服务器将在等待完成http请求时浪费大量CPU资源.
Many frameworks of application server use worker-thread-pool model. If the client machine is slow or far from Nginx and upstream server , without buffering http request in Nginx side, upstream server will waste pretty much CPU resource on waiting for completing a http request.
谢谢
推荐答案以下是代理模块Wiki页面中的报价:
请注意,在使用HTTP代理模块时(甚至在使用FastCGI时),整个客户端请求将在传递给后端代理服务器之前在nginx中进行缓冲.
Note that when using the HTTP Proxy Module (or even when using FastCGI), the entire client request will be buffered in nginx before being passed on to the backend proxied servers.
此外,在nginx 1.7之前,无法禁用请求缓冲(请参见#251 ).
Moreover before nginx 1.7 it wasn't possible to disable request buffering (see #251).
更多推荐
Nginx是否还会缓冲来自客户端的http请求?
发布评论