<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.0.10" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>

<channel>
	<title>听松一隅</title>
	<link>http://blog.quehy.com</link>
	<description>ALaRechercheDuTempsPerdu</description>
	<pubDate>Tue, 25 Mar 2008 12:30:01 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.0.10</generator>
	<language>en</language>
			<item>
		<title>谈谈异步IO(AIO)</title>
		<link>http://blog.quehy.com/archives/199.html</link>
		<comments>http://blog.quehy.com/archives/199.html#comments</comments>
		<pubDate>Mon, 24 Mar 2008 15:03:52 +0000</pubDate>
		<dc:creator>Q</dc:creator>
		
		<category>Tech</category>

		<guid isPermaLink="false">http://blog.quehy.com/archives/199.html</guid>
		<description><![CDATA[对于类似ligthy的事件(event)驱动的server，某个阻塞操作会大大降低程序的效率。文件读取操作通常是最容易堵塞的地方；而异步IO(AIO)貌似是解决文件堵塞的灵丹妙药。
大概三个月前，花了点时间在lighttpd 1.4.18上实现了AIO的支持，也是了结一个心病。由于原来的LINUX AIO计划早已停止，我拿POSIX AIO for LINUX 做实验平台，补丁也移植到比较新的2.6.23上。
拿ab测试，发现AIO的大文件吞吐性能很差，不到linux sendfile的一半，系统负载却大很多；让人感觉不可思议，怎么会这样呢？印象中lighty 1.5的aio测试效果还不错的。仔细拜读lighty 1.5的aio 代码，才恍然大悟：
1) AIO不支持sendfile。纯AIO实现 需要把文件内容读到内存中，然后再写到网络层上。为了不占用大量内存，一般是按1M或几M大小依次读取文件内容。AIO可以在读取完毕后通知服务程序，避免阻塞；但内容读取到用户内存中再写到网络层的效率很低
2) Lighty 1.5为解决上面的问题采取了两个办法，第一是多线程；第二是不到万不得已的情况不用AIO，大部分是用mmap/sendfile的。
再拜读Posix AIO规范说明，发现AIO原本意图是解决实时系统中文件操作堵塞的问题。实时系统中文件一般不大，文件操作也不频繁，AIO就比较合适。而在web服务中，适合AIO的前提条件并不存在，因此效果不佳也正常。POSIX AIO定义的操作也不多
最后写三点感想：
1) 完成某个工作的，可以用到的工具(开源项目)很多，选择时要对备选的工具多考察，选择最适合的，而不是看起来最美的
2) 功能不是越多越好，保持代码简洁、系统框架简洁很重要。比如我个人认为ligthy 1.5中引入glib库是个败笔
3) sendfile 很好。对它的多年优化工作可不是白费的

]]></description>
		<wfw:commentRss>http://blog.quehy.com/archives/199.html/feed/</wfw:commentRss>
		</item>
		<item>
		<title>强劲的lighty 1.4.18</title>
		<link>http://blog.quehy.com/archives/198.html</link>
		<comments>http://blog.quehy.com/archives/198.html#comments</comments>
		<pubDate>Mon, 17 Mar 2008 03:20:50 +0000</pubDate>
		<dc:creator>Q</dc:creator>
		
		<category>Tech</category>

		<guid isPermaLink="false">http://blog.quehy.com/archives/198.html</guid>
		<description><![CDATA[今天一不小心一台lighty 1.4.18+modcache 跑了1G带宽，强劲啊。
拜今天火箭22连胜比赛录像所赐


]]></description>
		<wfw:commentRss>http://blog.quehy.com/archives/198.html/feed/</wfw:commentRss>
		</item>
		<item>
		<title>mod_mem_cache patch for lighttpd 1.4.19</title>
		<link>http://blog.quehy.com/archives/197.html</link>
		<comments>http://blog.quehy.com/archives/197.html#comments</comments>
		<pubDate>Fri, 14 Mar 2008 02:23:53 +0000</pubDate>
		<dc:creator>Q</dc:creator>
		
		<category>Tech</category>

		<guid isPermaLink="false">http://blog.quehy.com/archives/197.html</guid>
		<description><![CDATA[You can download mod_mem_cache patch for lighttpd 1.4.19 from here.
patching steps:
tar xfz lighttpd-1.4.19.tar.gz; cd lighttpd-1.4.19
wget http://blog.quehy.com/doc/lighttpd-1.4.19.mod_mem_cache.patch;
patch -p0 < lighttpd-1.4.19.mod_mem_cache.patch
sh autogen.sh
then run "./configure --quiet; make"  to compile your lighttpd

]]></description>
		<wfw:commentRss>http://blog.quehy.com/archives/197.html/feed/</wfw:commentRss>
		</item>
		<item>
		<title>闲来无事，发个流量图</title>
		<link>http://blog.quehy.com/archives/196.html</link>
		<comments>http://blog.quehy.com/archives/196.html#comments</comments>
		<pubDate>Thu, 13 Mar 2008 10:20:15 +0000</pubDate>
		<dc:creator>Q</dc:creator>
		
		<category>Tech</category>

		<guid isPermaLink="false">http://blog.quehy.com/archives/196.html</guid>
		<description><![CDATA[
os: rhel 4
ram: 4G
software: lighttpd 1.4+modcache

]]></description>
		<wfw:commentRss>http://blog.quehy.com/archives/196.html/feed/</wfw:commentRss>
		</item>
		<item>
		<title>modcache v1.4.3 released</title>
		<link>http://blog.quehy.com/archives/195.html</link>
		<comments>http://blog.quehy.com/archives/195.html#comments</comments>
		<pubDate>Sat, 01 Mar 2008 12:52:11 +0000</pubDate>
		<dc:creator>Q</dc:creator>
		
		<category>Tech</category>

		<guid isPermaLink="false">http://blog.quehy.com/archives/195.html</guid>
		<description><![CDATA[I backport modcache v1.4.2 to lighttpd 1.4.18 as modcache v1.4.3
Changelog:

fix bug on handle of fetchall-for-range-request option 
new 'flv_streaming' option to work with mod_flv_streaming module

I update examples to demonstrate how mod_cache works with mod_flv_streaming.
homepage

]]></description>
		<wfw:commentRss>http://blog.quehy.com/archives/195.html/feed/</wfw:commentRss>
		</item>
		<item>
		<title>modcache v1.4.1 released</title>
		<link>http://blog.quehy.com/archives/194.html</link>
		<comments>http://blog.quehy.com/archives/194.html#comments</comments>
		<pubDate>Sun, 23 Sep 2007 15:02:37 +0000</pubDate>
		<dc:creator>Q</dc:creator>
		
		<category>Tech</category>

		<guid isPermaLink="false">http://blog.quehy.com/archives/194.html</guid>
		<description><![CDATA[Changelog:

 upgrade lighttpd 1.5 to r1922
put splaytree.c into mod_cache.c
fix memory leak on handler_ctx usage
fix memory leak on splaytree_splay usage

Hope you guys like it.
homepage

]]></description>
		<wfw:commentRss>http://blog.quehy.com/archives/194.html/feed/</wfw:commentRss>
		</item>
		<item>
		<title>modcache 1.4 released</title>
		<link>http://blog.quehy.com/archives/193.html</link>
		<comments>http://blog.quehy.com/archives/193.html#comments</comments>
		<pubDate>Fri, 11 May 2007 07:58:09 +0000</pubDate>
		<dc:creator>Q</dc:creator>
		
		<category>Tech</category>

		<guid isPermaLink="false">http://blog.quehy.com/archives/193.html</guid>
		<description><![CDATA[changelog:

updated to lighttpd 1.5.0 r1811
status page for mod_status added
cache.ignore-hostname added
bugfix for checking cachehd file

homepage
]]></description>
		<wfw:commentRss>http://blog.quehy.com/archives/193.html/feed/</wfw:commentRss>
		</item>
		<item>
		<title>mod_mem_cache for lighttpd 1.5.0.r1811</title>
		<link>http://blog.quehy.com/archives/192.html</link>
		<comments>http://blog.quehy.com/archives/192.html#comments</comments>
		<pubDate>Thu, 03 May 2007 14:11:41 +0000</pubDate>
		<dc:creator>Q</dc:creator>
		
		<category>Tech</category>

		<guid isPermaLink="false">http://blog.quehy.com/archives/192.html</guid>
		<description><![CDATA[mod_mem_cache got slightly update for lighttpd 1.5.0 r1811. detail documentation is here
download patch here

]]></description>
		<wfw:commentRss>http://blog.quehy.com/archives/192.html/feed/</wfw:commentRss>
		</item>
		<item>
		<title>推荐HAproxy 1.3.9</title>
		<link>http://blog.quehy.com/archives/191.html</link>
		<comments>http://blog.quehy.com/archives/191.html#comments</comments>
		<pubDate>Wed, 25 Apr 2007 10:28:36 +0000</pubDate>
		<dc:creator>Q</dc:creator>
		
		<category>Tech</category>

		<guid isPermaLink="false">http://blog.quehy.com/archives/191.html</guid>
		<description><![CDATA[Willy TARREAU 刚发布了1.3.9版本的haproxy, 支持FreeBSD kqueue；为支持FreeBSD kqueue，event处理机制也全面改进（机制类似lighty）。在阅读代码后，我可下个结论：Haproxy里最后一块“古老的”、“落后的“代码顽疾也消除了，部署HAproxy的最后障碍也烟消云散了。
作者对haproxy 1.3.9做了最新的Benchmark，硬件是单核P4 CPU，PCI Express Gigabit网卡，效果非常好。

源代码下载

]]></description>
		<wfw:commentRss>http://blog.quehy.com/archives/191.html/feed/</wfw:commentRss>
		</item>
		<item>
		<title>恶劣网络环境增加程序鲁棒性</title>
		<link>http://blog.quehy.com/archives/190.html</link>
		<comments>http://blog.quehy.com/archives/190.html#comments</comments>
		<pubDate>Tue, 24 Apr 2007 07:32:13 +0000</pubDate>
		<dc:creator>Q</dc:creator>
		
		<category>无题</category>

		<guid isPermaLink="false">http://blog.quehy.com/archives/190.html</guid>
		<description><![CDATA[最近一直被程序的memory leak和不稳定所困扰，memory leak已经是个大麻烦，让我花了两个星期才基本抓尽（怀疑还有小泄漏存在）。相对于memory leak，更头大的麻烦是服务器程序的不稳定：程序有时候一启动就segment fault，有时要等好几个小时，一直没有办法定位。从多年编程经验分析，应该是个很弱智的bug，否则不会在各种稀奇古怪的情况下segment fault。今天突然来了灵感，在几个关键点打印message，很快就定位bug，给出的Bugfix只增加了一行代码而且。分析一下，这个bug在出现还没有连接上后端服务器之前用户中断连接才发生。只有在恶劣网络环境下，它发生的概率才很频繁，也给我定位它提供了机会。
这次经验告诉我们：恶劣网络环境有机会让程序跑得更稳定，哈哈

]]></description>
		<wfw:commentRss>http://blog.quehy.com/archives/190.html/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
