<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[沧海一粟]]></title> 
<link>http://www.dzhope.com/index.php</link> 
<description><![CDATA[Web系统架构与服务器运维,php开发]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[沧海一粟]]></copyright>
<item>
<link>http://www.dzhope.com/post//</link>
<title><![CDATA[varnish,squid,apache,nginx缓存文件比较]]></title> 
<author>jed &lt;jed521@163.com&gt;</author>
<category><![CDATA[服务器技术]]></category>
<pubDate>Thu, 28 Apr 2011 05:08:04 +0000</pubDate> 
<guid>http://www.dzhope.com/post//</guid> 
<description>
<![CDATA[ 
	<strong>一，测试环境</strong><br/>1，硬件是奔腾双核，机子三年前买的。系统是archlinux<br/><br/>2，测试varnish和squid的时候，web服务用的apache<br/><br/>3，测试apache的时候，启动了5个进程，不过随着压力的增加，进程会增加的。<br/><br/>4，测试nginx的时候，启动了十个nginx进程，20个php-cgi进程<br/><br/>5，varnish，squid，nginx用的是反向代理的形势，也就是说访问图片的时候，要先透过缓存工具<br/><br/><strong>二，测试</strong><br/><strong>1，varnish</strong><br/>[root@BlackGhost bin]# /usr/local/bin/webbench -c 100 -t 20 <a href="http://127.0.0.1:8080/00/01/RwGowEtWvcQAAAAAAAAWHH0Rklg81.gif" target="_blank">http://127.0.0.1:8080/00/01/RwGowEtWvcQAAAAAAAAWHH0Rklg81.gif</a><br/>Webbench – Simple Web Benchmark 1.5<br/>Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.<br/><br/>Benchmarking: GET <a href="http://127.0.0.1:8080/00/01/RwGowEtWvcQAAAAAAAAWHH0Rklg81.gif" target="_blank">http://127.0.0.1:8080/00/01/RwGowEtWvcQAAAAAAAAWHH0Rklg81.gif</a><br/>100 clients, running 20 sec.<br/><br/>Speed=476508 pages/min, 47258114 bytes/sec.<br/>Requests: 158836 susceed, 0 failed.<br/><br/>访问了这么次，没有缓存只有一次，效率真的很高。<br/><br/><strong>2，squid</strong><br/>[root@BlackGhost bin]# /usr/local/bin/webbench -c 100 -t 20 <a href="http://localhost:9000/00/01/RwGowEtWvcQAAAAAAAAWHH0Rklg81.gif" target="_blank">http://localhost:9000/00/01/RwGowEtWvcQAAAAAAAAWHH0Rklg81.gif</a><br/>Webbench – Simple Web Benchmark 1.5<br/>Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.<br/><br/>Benchmarking: GET <a href="http://localhost:9000/00/01/RwGowEtWvcQAAAAAAAAWHH0Rklg81.gif" target="_blank">http://localhost:9000/00/01/RwGowEtWvcQAAAAAAAAWHH0Rklg81.gif</a><br/>100 clients, running 20 sec.<br/><br/>Speed=133794 pages/min, 7475018 bytes/sec.<br/>Requests: 44598 susceed, 0 failed.<br/><br/>从测试效果来说，squid挺让我失望的，在测试前，我心里是这样估计的，缓存最好的是varnish，其次是squid，然后nginx，最后是apache，现在呢，squid是最差的。后来我看了一下log文件，发现正常情况下，缓存和没有缓存的比率不是1：2，如果在高压力下，缓存和没有缓存的比率更小。<br/><br/><strong>3，apache</strong><br/>[root@BlackGhost conf]# /usr/local/bin/webbench -c 100 -t 20 <a href="http://localhost/00/01/RwGowEtWvcQAAAAAAAAWHH0Rklg81.gif" target="_blank">http://localhost/00/01/RwGowEtWvcQAAAAAAAAWHH0Rklg81.gif</a><br/>Webbench – Simple Web Benchmark 1.5<br/>Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.<br/><br/>Benchmarking: GET <a href="http://localhost/00/01/RwGowEtWvcQAAAAAAAAWHH0Rklg81.gif" target="_blank">http://localhost/00/01/RwGowEtWvcQAAAAAAAAWHH0Rklg81.gif</a><br/>100 clients, running 20 sec.<br/><br/>Speed=160890 pages/min, 15856005 bytes/sec.<br/>Requests: 53630 susceed, 0 failed.<br/><br/><strong>4，nginx</strong><br/>[root@BlackGhost conf]# /usr/local/bin/webbench -c 100 -t 20 <a href="http://localhost:10000/00/01/RwGowEtWvcQAAAAAAAAWHH0Rklg81.gif" target="_blank">http://localhost:10000/00/01/RwGowEtWvcQAAAAAAAAWHH0Rklg81.gif</a><br/>Webbench – Simple Web Benchmark 1.5<br/>Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.<br/><br/>Benchmarking: GET <a href="http://localhost:10000/00/01/RwGowEtWvcQAAAAAAAAWHH0Rklg81.gif" target="_blank">http://localhost:10000/00/01/RwGowEtWvcQAAAAAAAAWHH0Rklg81.gif</a><br/>100 clients, running 20 sec.<br/><br/>Speed=304053 pages/min, 30121517 bytes/sec.<br/>Requests: 101351 susceed, 0 failed.<br/><br/>从上面的测试结果我们可以发现，varnish > nginx > apache > squid，我想这个结果，根大家预期的结果有点出入，因为squid做老牌文件缓存工具怎么会这么差呢，squid的命中率低，我在网上查了一下，很多人都是这样的，这个可能根个人配置有关系，也许真正的高手，才能让squid发挥最大功力。<br/><br/><br/>Tags - <a href="http://www.dzhope.com/tags/varnish/" rel="tag">varnish</a> , <a href="http://www.dzhope.com/tags/squid/" rel="tag">squid</a> , <a href="http://www.dzhope.com/tags/apache/" rel="tag">apache</a> , <a href="http://www.dzhope.com/tags/nginx/" rel="tag">nginx</a> , <a href="http://www.dzhope.com/tags/%25E7%25BC%2593%25E5%25AD%2598%25E6%25AF%2594%25E8%25BE%2583/" rel="tag">缓存比较</a>
]]>
</description>
</item><item>
<link>http://www.dzhope.com/post//#blogcomment</link>
<title><![CDATA[[评论] varnish,squid,apache,nginx缓存文件比较]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>http://www.dzhope.com/post//#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>