nginx 的 proxy_buffers 到底是什么意思?为什么有大小和块数?而不是一大块?

2014-02-21 09:56:46 +08:00
 flytwokites
nginx的文档很操蛋,就一句话:

Syntax:
proxy_buffers number size

This directive sets the number and the size of buffers, into which will be read the answer, obtained from the proxied server. By default, the size of one buffer is equal to the size of page. Depending on platform this is either 4K or 8K.

这个size是指*单个*请求的最大缓存吗?比如一个文件有10M,那设置size为4K的话是不是就只缓存了头4K,其它就用硬盘来缓存了?
还有这个number,指的是同时最有多number个请求可以缓存吗?
6270 次点击
所在节点    NGINX
3 条回复
est
2014-02-21 10:08:39 +08:00
http://en.wikipedia.org/wiki/Page_(computer_memory)

proxy_buffers 满了不射,就会阻塞。
flytwokites
2014-02-21 10:14:13 +08:00
@est 具体什么意思?

size为8K,nginx收到头2K时应该同时已经在往客户端发了吧?不会傻等8K都到齐了再射吧?
est
2014-02-21 10:36:07 +08:00
@flytwokites

这么理解好了。

buffer 就是京东的仓库。 你买异地仓库东西,假如本地仓库容量为4,如果同时5个人买,那么肯定是第一批4个人移仓完毕了送货完毕了,才会开始第五个人的移仓。

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/101167

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX