{"id":1129,"date":"2011-10-20T15:16:00","date_gmt":"2011-10-20T07:16:00","guid":{"rendered":"\/?p=1129"},"modified":"2011-10-20T15:16:00","modified_gmt":"2011-10-20T15:16:00","slug":"1129","status":"publish","type":"post","link":"https:\/\/blog.vimge.com\/archives\/architecture\/1129.html","title":{"rendered":"\u8c08\u8c08varnish\u3001squid\u3001apache\u3001nginx\u7f13\u5b58\u7684\u5bf9\u6bd4"},"content":{"rendered":"

<\/p>\n

1.Squid<\/b>\uff0c\u5f88\u53e4\u8001\u7684\u53cd\u5411\u4ee3\u7406\u8f6f\u4ef6\uff0c\u62e5\u6709\u4f20\u7edf\u4ee3\u7406\u3001\u8eab\u4efd\u9a8c\u8bc1\u3001\u6d41\u91cf\u7ba1\u7406\u7b49\u9ad8\u7ea7\u529f\u80fd\uff0c\u4f46\u662f\u914d\u7f6e\u592a\u590d\u6742\u3002\u5b83\u7b97\u662f\u76ee\u524d\u4e92\u8054\u7f51\u5e94\u7528\u5f97\u6700\u591a\u7684\u53cd\u5411\u7f13\u5b58\u4ee3\u7406\u670d\u52a1\u5668\uff0c\u5de5\u4f5c\u4e8e\u5404\u5927\u53e4\u8001\u7684cdn\u4e0a\u3002<\/p>\n

2.Varnish<\/b>\u662f\u65b0\u5174\u7684\u4e00\u4e2a\u8f6f\u4ef6\uff0c\u8bbe\u8ba1\u7b80\u5355\uff0c\u66f4\u7b26\u5408\u76ee\u524d\u4e92\u8054\u7f51\u7684\u5e94\u7528\uff0c\u5f88\u591a\u516c\u53f8\u90fd\u91c7\u7528\u4e86varnish\u8fd9\u4e2a\u8f6f\u4ef6\uff0c\u6bd4\u5982\u5fae\u535a\u7684openapi  http:\/\/open.t.sina.com.cn \u3002Varnish\u662f\u57fa\u4e8e\u5185\u5b58\u7f13\u5b58\uff0c\u91cd\u542f\u540e\u6570\u636e\u5c06\u6d88\u5931\u3002<\/b><\/p>\n

3.nginx<\/b> nginx\u7684\u53cd\u5411\u4ee3\u7406\u7f13\u5b58\u662f\u901a\u8fc7\u4e00\u4e2a\u6a21\u5757\u5b9eproxy_cache\u6765\u5b9e\u73b0\u7684\uff0c\u76ee\u524d\u8fd9\u4e2a\u6a21\u5757\u8fd8\u5728\u5b8c\u5584\u4e2d\uff0c\u4f46\u662f\u5f88\u591a\u516c\u53f8\u5df2\u7ecf\u5f00\u59cb\u4f7f\u7528\u4e86\u3002<\/p>\n

 <\/p>\n<\/p>\n

\u7fa4\u91cc\u603b\u662f\u6709\u4eba\u5728\u95eecache\u7528\u4ec0\u4e48\uff0c\u6709varnish\uff0csquid\uff0capache\uff0cnginx\u8fd9\u51e0\u79cd\uff0c\u5230\u5e95\u662f\u6211\u4eec\u7528\u4ec0\u4e48\u67b6\u6784cache\u3002<\/p>\n

1\u3001\u4ece\u8fd9\u4e9b\u529f\u80fd\u4e0a\u3002varnish\u548csquid\u662f\u4e13\u4e1a\u7684cache\u670d\u52a1\uff0c\u800capache\uff0cnginx\u8fd9\u4e9b\u90fd\u662f\u7b2c\u4e09\u65b9\u6a21\u5757\u5b8c\u6210\u3002<\/p>\n

2\u3001\u8981\u505acache\u670d\u52a1\u7684\u8bdd\uff0c\u6211\u4eec\u80af\u5b9a\u662f\u8981\u9009\u62e9\u4e13\u4e1a\u7684cache\u670d\u52a1\uff0c\u4f18\u5148\u9009\u62e9squid\u548cvarnish\u3002<\/p>\n

varnish\u672c\u8eab\u7684\u6280\u672f\u4e0a\u4f18\u52bf\u8981\u9ad8\u4e8esquid\uff0c\u5b83\u91c7\u7528\u4e86\u201cVisual Page Cache\u201d\u6280\u672f\uff0c\u5728\u5185\u5b58\u7684\u5229\u7528\u4e0a\uff0cVarnish\u6bd4Squid\u5177\u6709\u4f18\u52bf\uff0c\u5b83\u907f\u514d\u4e86Squid\u9891\u7e41\u5728\u5185\u5b58\u3001\u78c1\u76d8\u4e2d\u4ea4\u6362\u6587\u4ef6\uff0c\u6027\u80fd\u8981\u6bd4Squid\u9ad8\u3002varnish\u662f\u4e0d\u80fdcache\u5230\u672c\u5730\u786c\u76d8\u4e0a\u7684\u3002<\/p>\n

\u8fd8\u6709\u5f3a\u5927\u7684\u901a\u8fc7Varnish\u7ba1\u7406\u7aef\u53e3\uff0c\u53ef\u4ee5\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f\u5feb\u901f\u3001\u6279\u91cf\u5730\u6e05\u9664\u90e8\u5206\u7f13\u5b58<\/p>\n

squid\u7684\u4f18\u52bf\u5728\u4e8e\u5b8c\u6574\u7684\u5e9e\u5927\u7684cache\u6280\u672f\u8d44\u6599\uff0c\u548c\u5f88\u591a\u7684\u5e94\u7528\u751f\u4ea7\u73af\u5883\uff08\u8fd9\u5e94\u8be5\u4e0esquid\u65e9\u51fa\u6765\u6709\u5173\uff09\u3002<\/p>\n

3\u3001\u8c08\u8c08nginx\uff0cnginx\u662f\u7528\u7b2c\u4e09\u65b9\u6a21\u5757ncache\u505a\u7684\u7f13\u51b2\uff0c\u5176\u6027\u80fd\u57fa\u672c\u8fbe\u5230varnish\uff0c\u4f46\u5728\u67b6\u6784\u4e2dnginx\u4e00\u822c\u4f5c\u4e3a\u53cd\u5411\uff08\u9759\u6001\u6587\u4ef6\u73b0\u5728\u7528nginx\u7684\u5f88\u591a\uff0c\u5e76\u53d1\u80fd\u652f\u6301\u52302\u4e07+\uff09\u3002\u5728\u9759\u6001\u67b6\u6784\u4e2d\uff0c\u5982\u679c\u524d\u7aef\u76f4\u63a5\u9762\u5bf9\u7684\u662fcdn\u6d3b\u7740\u524d\u7aef\u4e864\u5c42\u8d1f\u8f7d\u7684\u8bdd\uff0c\u5b8c\u5168\u7528nginx\u7684cache\u5c31\u591f\u4e86\u3002<\/p>\n

4\u3001\u672c\u4eba\u89c9\u5f97\u5982\u679c\u662f\u5728apache\u670d\u52a1\u4e0a\u63d0\u5347\u6027\u80fd\uff0c\u505a\u4e00\u4e9b\u672c\u5730cache\u662f\u5b8c\u5168\u53ef\u4ee5\u7684\uff0c\u4f46\u5982\u679c\u5728\u7cfb\u7edf\u67b6\u6784\u4e2d\u7528apache\u505acache\u670d\u52a1\uff0c\u90a3\u5c31\u6709\u70b9\u725b\u5934\u4e0d\u5bf9\u9a6c\u5c3e\u4e86\u3002<\/p>\n

—————————————<\/p>\n

\u4ee5\u4e0b\u662f\u8f6c\u8f7d\u4e86\u4e00\u4e2a\u540c\u5b66\u7684\u6d4b\u8bd5\u6570\u636e<\/p>\n

\u4e00\uff0c\u6d4b\u8bd5\u73af\u5883<\/strong><\/p>\n

1\uff0c\u786c\u4ef6\u662f\u5954\u817e\u53cc\u6838\uff0c\u673a\u5b50\u4e09\u5e74\u524d\u4e70\u7684\u3002\u7cfb\u7edf\u662farchlinux<\/p>\n

2\uff0c\u6d4b\u8bd5varnish\u548csquid\u7684\u65f6\u5019\uff0cweb\u670d\u52a1\u7528\u7684apache<\/p>\n

3\uff0c\u6d4b\u8bd5apache\u7684\u65f6\u5019\uff0c\u542f\u52a8\u4e865\u4e2a\u8fdb\u7a0b\uff0c\u4e0d\u8fc7\u968f\u7740\u538b\u529b\u7684\u589e\u52a0\uff0c\u8fdb\u7a0b\u4f1a\u589e\u52a0\u7684\u3002<\/p>\n

4\uff0c\u6d4b\u8bd5nginx\u7684\u65f6\u5019\uff0c\u542f\u52a8\u4e86\u5341\u4e2anginx\u8fdb\u7a0b\uff0c20\u4e2aphp-cgi\u8fdb\u7a0b<\/p>\n<\/p>\n

5\uff0cvarnish\uff0csquid\uff0cnginx\u7528\u7684\u662f\u53cd\u5411\u4ee3\u7406\u7684\u5f62\u52bf\uff0c\u4e5f\u5c31\u662f\u8bf4\u8bbf\u95ee\u56fe\u7247\u7684\u65f6\u5019\uff0c\u8981\u5148\u900f\u8fc7\u7f13\u5b58\u5de5\u5177<\/p>\n

\u4e8c\uff0c\u6d4b\u8bd5<\/strong><\/p>\n

1\uff0cvarnish<\/strong><\/p>\n

[root@BlackGhost bin]# \/usr\/local\/bin\/webbench -c 100 -t 20 http:\/\/127.0.0.1:8080\/00\/01\/RwGowEtWvcQAAAAAAAAWHH0Rklg81.gif
Webbench – Simple Web Benchmark 1.5
Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.<\/p>\n

Benchmarking: GET http:\/\/127.0.0.1:8080\/00\/01\/RwGowEtWvcQAAAAAAAAWHH0Rklg81.gif
100 clients, running 20 sec.<\/p>\n

Speed=476508 pages\/min, 47258114 bytes\/sec.
Requests: 158836 susceed, 0 failed.<\/strong><\/p>\n

varnish\u7684\u7f13\u5b58\u6548\u7387\u547d\u4e2d\u7387\u771f\u7684\u597d\u9ad8\uff0c\u770b\u4e0b\u56fe\uff1a<\/p>\n

\"varnish\"<\/a><\/p>\n

varnish<\/p>\n<\/div>\n

\u8bbf\u95ee\u4e86\u8fd9\u4e48\u6b21\uff0c\u6ca1\u6709\u7f13\u5b58\u53ea\u6709\u4e00\u6b21\uff0c\u6548\u7387\u771f\u7684\u5f88\u9ad8\u3002<\/p>\n

2\uff0csquid<\/strong><\/p>\n

[root@BlackGhost bin]# \/usr\/local\/bin\/webbench -c 100 -t 20 http:\/\/localhost:9000\/00\/01\/RwGowEtWvcQAAAAAAAAWHH0Rklg81.gif
Webbench – Simple Web Benchmark 1.5
Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.<\/p>\n

Benchmarking: GET http:\/\/localhost:9000\/00\/01\/RwGowEtWvcQAAAAAAAAWHH0Rklg81.gif
100 clients, running 20 sec.<\/p>\n

Speed=133794 pages\/min, 7475018 bytes\/sec.
Requests: 44598 susceed, 0 failed.<\/strong><\/p>\n

\u4ece\u6d4b\u8bd5\u6548\u679c\u6765\u8bf4\uff0csquid\u633a\u8ba9\u6211\u5931\u671b\u7684\uff0c\u5728\u6d4b\u8bd5\u524d\uff0c\u6211\u5fc3\u91cc\u662f\u8fd9\u6837\u4f30\u8ba1\u7684\uff0c\u7f13\u5b58\u6700\u597d\u7684\u662fvarnish\uff0c\u5176\u6b21\u662fsquid\uff0c\u7136\u540enginx\uff0c\u6700\u540e\u662fapache\uff0c\u73b0\u5728\u5462\uff0csquid\u662f\u6700\u5dee\u7684\u3002\u540e\u6765\u6211\u770b\u4e86\u4e00\u4e0blog\u6587\u4ef6\uff0c\u53d1\u73b0\u6b63\u5e38\u60c5\u51b5\u4e0b\uff0c\u7f13\u5b58\u548c\u6ca1\u6709\u7f13\u5b58\u7684\u6bd4\u7387\u4e0d\u662f1\uff1a2\uff0c\u5982\u679c\u5728\u9ad8\u538b\u529b\u4e0b\uff0c\u7f13\u5b58\u548c\u6ca1\u6709\u7f13\u5b58\u7684\u6bd4\u7387\u66f4\u5c0f\u3002<\/p>\n

3\uff0capache<\/strong><\/p>\n

[root@BlackGhost conf]# \/usr\/local\/bin\/webbench -c 100 -t 20 http:\/\/localhost\/00\/01\/RwGowEtWvcQAAAAAAAAWHH0Rklg81.gif
Webbench – Simple Web Benchmark 1.5
Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.<\/p>\n

Benchmarking: GET http:\/\/localhost\/00\/01\/RwGowEtWvcQAAAAAAAAWHH0Rklg81.gif
100 clients, running 20 sec.<\/p>\n

Speed=160890 pages\/min, 15856005 bytes\/sec.
Requests: 53630 susceed, 0 failed.<\/strong><\/p>\n

4\uff0cnginx<\/strong><\/p>\n

[root@BlackGhost conf]# \/usr\/local\/bin\/webbench -c 100 -t 20 http:\/\/localhost:10000\/00\/01\/RwGowEtWvcQAAAAAAAAWHH0Rklg81.gif
Webbench – Simple Web Benchmark 1.5
Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.<\/p>\n

Benchmarking: GET http:\/\/localhost:10000\/00\/01\/RwGowEtWvcQAAAAAAAAWHH0Rklg81.gif
100 clients, running 20 sec.<\/p>\n

Speed=304053 pages\/min, 30121517 bytes\/sec.
Requests: 101351 susceed, 0 failed.<\/strong><\/p>\n

\u4ece\u4e0a\u9762\u7684\u6d4b\u8bd5\u7ed3\u679c\u6211\u4eec\u53ef\u4ee5\u53d1\u73b0\uff0cvarnish > nginx > apache > squid\uff0c\u6211\u60f3\u8fd9\u4e2a\u7ed3\u679c\uff0c\u6839\u5927\u5bb6\u9884\u671f\u7684\u7ed3\u679c\u6709\u70b9\u51fa\u5165\uff0c\u56e0\u4e3asquid\u505a\u8001\u724c\u6587\u4ef6\u7f13\u5b58\u5de5\u5177\u600e\u4e48\u4f1a\u8fd9\u4e48\u5dee\u5462\uff0csquid\u7684\u547d\u4e2d\u7387\u4f4e\uff0c\u6211\u5728\u7f51\u4e0a\u67e5\u4e86\u4e00\u4e0b\uff0c\u5f88\u591a\u4eba\u90fd\u662f\u8fd9\u6837\u7684\uff0c\u8fd9\u4e2a\u53ef\u80fd\u6839\u4e2a\u4eba\u914d\u7f6e\u6709\u5173\u7cfb\uff0c\u4e5f\u8bb8\u771f\u6b63\u7684\u9ad8\u624b\uff0c\u624d\u80fd\u8ba9squid\u53d1\u6325\u6700\u5927\u529f\u529b\u3002<\/p>\n

http:\/\/www.cnblogs.com\/google4y\/archive\/2011\/09\/19\/2181251.html<\/a><\/p>\n

<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"

<\/p>\n

1.Squid<\/b>\uff0c\u5f88\u53e4\u8001\u7684\u53cd\u5411\u4ee3\u7406\u8f6f\u4ef6\uff0c\u62e5\u6709\u4f20\u7edf\u4ee3\u7406\u3001\u8eab\u4efd\u9a8c\u8bc1\u3001\u6d41\u91cf\u7ba1\u7406\u7b49\u9ad8\u7ea7\u529f\u80fd\uff0c\u4f46\u662f\u914d\u7f6e\u592a\u590d\u6742\u3002\u5b83\u7b97\u662f\u76ee\u524d\u4e92\u8054\u7f51\u5e94\u7528\u5f97\u6700\u591a\u7684\u53cd\u5411\u7f13\u5b58\u4ee3\u7406\u670d\u52a1\u5668\uff0c\u5de5\u4f5c\u4e8e\u5404\u5927\u53e4\u8001\u7684cdn\u4e0a\u3002<\/p>\n

2.Varnish<\/b>\u662f\u65b0\u5174\u7684\u4e00\u4e2a\u8f6f\u4ef6\uff0c\u8bbe\u8ba1\u7b80\u5355\uff0c\u66f4\u7b26\u5408\u76ee\u524d\u4e92\u8054\u7f51\u7684\u5e94\u7528\uff0c\u5f88\u591a\u516c\u53f8\u90fd\u91c7\u7528\u4e86varnish\u8fd9\u4e2a\u8f6f\u4ef6\uff0c\u6bd4\u5982\u5fae\u535a\u7684openapi  http:\/\/open.t.sina.com.cn \u3002Varnish\u662f\u57fa\u4e8e\u5185\u5b58\u7f13\u5b58\uff0c\u91cd\u542f\u540e\u6570\u636e\u5c06\u6d88\u5931\u3002<\/b><\/p>\n

3.nginx<\/b> nginx\u7684\u53cd\u5411\u4ee3\u7406\u7f13\u5b58\u662f\u901a\u8fc7\u4e00\u4e2a\u6a21\u5757\u5b9e<\/p>\n

<\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[5],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/posts\/1129"}],"collection":[{"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/comments?post=1129"}],"version-history":[{"count":0,"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/posts\/1129\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/media?parent=1129"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/categories?post=1129"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.vimge.com\/wp-json\/wp\/v2\/tags?post=1129"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}