<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[张宴的博客]]></title> 
<link>http://zyan.cc/index.php</link> 
<description><![CDATA[Web系统架构与底层研发]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[张宴的博客]]></copyright>
<item>
<link>http://zyan.cc/post/362/</link>
<title><![CDATA[利用Tokyo Tyrant构建兼容Memcached协议、支持故障转移、高并发的分布式key-value持久存储系统[原创]]]></title> 
<author>张宴 &lt;net@s135.com&gt;</author>
<category><![CDATA[Cache与存储]]></category>
<pubDate>Thu, 07 Aug 2008 00:53:40 +0000</pubDate> 
<guid>http://zyan.cc/post/362/</guid> 
<description>
<![CDATA[ 
	　　[文章作者：张宴 本文版本：v1.4 最后修改：2010.06.11 转载请注明原文链接：<a href="http://blog.zyan.cc/read.php/362/" target="_blank">http://blog.zyan.cc/read.php/362/</a>]<br/><br/>　　<a href="http://www.1978th.net/tokyocabinet/" target="_blank">Tokyo Cabinet</a> 是日本人 平林幹雄 开发的一款 DBM 数据库，该数据库读写非常快，哈希模式写入100万条数据只需0.643秒，读取100万条数据只需0.773秒，是 Berkeley DB 等 DBM 的几倍。<br/><br/>　　<a href="http://zyan.cc/attachment/200808/tokyocabinet.gif" target="_blank"><img src="http://zyan.cc/attachment/200808/tokyocabinet.gif" class="insertimage" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a><br/><br/><hr/><br/>　　<a href="http://www.1978th.net/tokyotyrant/" target="_blank">Tokyo Tyrant</a> 是由同一作者开发的 Tokyo Cabinet 数据库网络接口。它拥有Memcached兼容协议，也可以通过HTTP协议进行数据交换。<br/><br/>　　Tokyo Tyrant 加上 Tokyo Cabinet，构成了一款支持高并发的分布式持久存储系统，对任何原有Memcached客户端来讲，可以将Tokyo Tyrant看成是一个Memcached，但是，它的数据是可以持久存储的。这一点，跟新浪的<a href="http://memcachedb.org/" target="_blank">Memcachedb</a>性质一样。<br/><br/>　　<strong>相比Memcachedb而言，Tokyo Tyrant具有以下优势：</strong><br/><br/>　　1、故障转移：Tokyo Tyrant支持双机互为主辅模式，主辅库均可读写，而Memcachedb目前支持类似MySQL主辅库同步的方式实现读写分离，支持“主服务器可读写、辅助服务器只读”模式。<br/><br/>　　<a href="http://zyan.cc/attachment/200808/addserver.gif" target="_blank"><img src="http://zyan.cc/attachment/200808/addserver.gif" class="insertimage" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a><br/><br/>　　这里使用 $memcache->addServer 而不是 $memcache->connect 去连接 Tokyo Tyrant 服务器，是因为当 Memcache 客户端使用 addServer 服务器池时，是根据“crc32(key) % current_server_num”哈希算法将 key 哈希到不同的服务器的，PHP、C 和 python 的客户端都是如此的算法。Memcache 客户端的 addserver 具有故障转移机制，当 addserver 了2台 Memcached 服务器，而其中1台宕机了，那么 current_server_num 会由原先的2变成1。<br/><br/>　　引用 memcached 官方网站和 PHP 手册中的两段话： <br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content">http://www.danga.com/memcached/ <br/>If a host goes down, the API re-maps that dead host's requests onto the servers that are available. <br/><br/><a href="http://cn.php.net/manual/zh/function.Memcache-addServer.php" target="_blank">http://cn.php.net/manual/zh/function.Memcache-addServer.php</a> <br/>Failover may occur at any stage in any of the methods, as long as other servers are available the request the user won't notice. Any kind of socket or Memcached server level errors (except out-of-memory) may trigger the failover. Normal client errors such as adding an existing key will not trigger a failover. </div></div><br/><br/><hr/><br/>　　2、日志文件体积小：Tokyo Tyrant用于主辅同步的日志文件比较小，大约是数据库文件的1.3倍，而Memcachedb的同步日志文件非常大，如果不定期清理，很容易将磁盘写满。<br/><br/><hr/><br/>　　3、超大数据量下表现出色：<br/><br/>............<br/><br/>Tags - <a href="http://zyan.cc/tags/linux/" rel="tag">linux</a> , <a href="http://zyan.cc/tags/php/" rel="tag">php</a> , <a href="http://zyan.cc/tags/cache/" rel="tag">cache</a> , <a href="http://zyan.cc/tags/memcached/" rel="tag">memcached</a> , <a href="http://zyan.cc/tags/memcachedb/" rel="tag">memcachedb</a> , <a href="http://zyan.cc/tags/dbcached/" rel="tag">dbcached</a> , <a href="http://zyan.cc/tags/qdbm/" rel="tag">qdbm</a> , <a href="http://zyan.cc/tags/tokyotyrant/" rel="tag">tokyotyrant</a> , <a href="http://zyan.cc/tags/ttserver/" rel="tag">ttserver</a> , <a href="http://zyan.cc/tags/tokyocabinet/" rel="tag">tokyocabinet</a>
]]>
</description>
</item><item>
<link>http://zyan.cc/post/362/#blogcomment1409</link>
<title><![CDATA[[评论] 利用Tokyo Tyrant构建兼容Memcached协议、支持故障转移、高并发的分布式key-value持久存储系统[原创]]]></title> 
<author>dd_macle &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 07 Aug 2008 05:46:35 +0000</pubDate> 
<guid>http://zyan.cc/post/362/#blogcomment1409</guid> 
<description>
<![CDATA[ 
	每天都来看你的博客，当看到有新文章发表的时候，都是第一时间看完，虽然我现在不从事mysql方面的研究，但从你这里还是学到很多很多。。。。。。
]]>
</description>
</item><item>
<link>http://zyan.cc/post/362/#blogcomment1410</link>
<title><![CDATA[[评论] 利用Tokyo Tyrant构建兼容Memcached协议、支持故障转移、高并发的分布式key-value持久存储系统[原创]]]></title> 
<author>try &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 07 Aug 2008 08:03:07 +0000</pubDate> 
<guid>http://zyan.cc/post/362/#blogcomment1410</guid> 
<description>
<![CDATA[ 
	good... memcachedb在高负载和高数据量下客户端会出现连接异常...准备试试这个
]]>
</description>
</item><item>
<link>http://zyan.cc/post/362/#blogcomment1411</link>
<title><![CDATA[[评论] 利用Tokyo Tyrant构建兼容Memcached协议、支持故障转移、高并发的分布式key-value持久存储系统[原创]]]></title> 
<author>peter &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 07 Aug 2008 09:50:26 +0000</pubDate> 
<guid>http://zyan.cc/post/362/#blogcomment1411</guid> 
<description>
<![CDATA[ 
	不错 强大
]]>
</description>
</item><item>
<link>http://zyan.cc/post/362/#blogcomment1412</link>
<title><![CDATA[[评论] 利用Tokyo Tyrant构建兼容Memcached协议、支持故障转移、高并发的分布式key-value持久存储系统[原创]]]></title> 
<author>outrace &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 07 Aug 2008 13:26:40 +0000</pubDate> 
<guid>http://zyan.cc/post/362/#blogcomment1412</guid> 
<description>
<![CDATA[ 
	非常感谢博主。<br/>不过memcachedb的作者做的性能测试，（<a href="http://memcachedb.org/benchmark.html" target="_blank">http://memcachedb.org/benchmark.html</a>）<br/>单线程下memcachedb能做到，读18868/s，写44444/s<br/>怎么比博主说的Tyrant的每秒1W请求要高啊？<br/><br/>另外想请教博主：<br/>对分布式的文件系统是否有研究。<br/>比如：GlusterFS=&gt;<a href="http://www.gluster.org/" target="_blank">http://www.gluster.org/</a><br/> &nbsp; &nbsp; &nbsp; &nbsp; MogileFS=&gt;<a href="http://www.danga.com/mogilefs/" target="_blank">http://www.danga.com/mogilefs/</a><br/> &nbsp; &nbsp; &nbsp; &nbsp; FastDFS=&gt;<a href="http://code.google.com/p/fastdfs/" target="_blank">http://code.google.com/p/fastdfs/</a><br/> &nbsp; &nbsp; &nbsp; &nbsp; HDFS=&gt;<a href="http://hadoop.apache.org/core/docs/current/hdfs_design.html" target="_blank">http://hadoop.apache.org/core/docs/current/hdfs_design.html</a><br/>当然还有其他一些<br/>不知道博主是否有这方面的经验可供分享，谢谢。
]]>
</description>
</item><item>
<link>http://zyan.cc/post/362/#blogcomment1414</link>
<title><![CDATA[[评论] 利用Tokyo Tyrant构建兼容Memcached协议、支持故障转移、高并发的分布式key-value持久存储系统[原创]]]></title> 
<author>Run &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Fri, 08 Aug 2008 06:00:48 +0000</pubDate> 
<guid>http://zyan.cc/post/362/#blogcomment1414</guid> 
<description>
<![CDATA[ 
	哥们，无意中进了你的blog，呵呵，我就要上中南民大了，就快要成校友了，呵呵，有空可以联系我哦gtalk:runxiao@gmail.com
]]>
</description>
</item><item>
<link>http://zyan.cc/post/362/#blogcomment1415</link>
<title><![CDATA[[评论] 利用Tokyo Tyrant构建兼容Memcached协议、支持故障转移、高并发的分布式key-value持久存储系统[原创]]]></title> 
<author>hutoo &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Fri, 08 Aug 2008 06:54:15 +0000</pubDate> 
<guid>http://zyan.cc/post/362/#blogcomment1415</guid> 
<description>
<![CDATA[ 
	请问这套东西稳定吗？有成功案例吗？
]]>
</description>
</item><item>
<link>http://zyan.cc/post/362/#blogcomment1423</link>
<title><![CDATA[[评论] 利用Tokyo Tyrant构建兼容Memcached协议、支持故障转移、高并发的分布式key-value持久存储系统[原创]]]></title> 
<author>routerpipe &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 14 Aug 2008 01:20:43 +0000</pubDate> 
<guid>http://zyan.cc/post/362/#blogcomment1423</guid> 
<description>
<![CDATA[ 
	哥们儿，不知什么原因，新浪视频我从来没有打开过，总是不出画面。
]]>
</description>
</item><item>
<link>http://zyan.cc/post/362/#blogcomment1426</link>
<title><![CDATA[[评论] 利用Tokyo Tyrant构建兼容Memcached协议、支持故障转移、高并发的分布式key-value持久存储系统[原创]]]></title> 
<author>routerpipe &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 14 Aug 2008 05:15:30 +0000</pubDate> 
<guid>http://zyan.cc/post/362/#blogcomment1426</guid> 
<description>
<![CDATA[ 
	flash是出来的，视频出不来，我看youku ku6 tudou youtube等都正常，就新浪无法观看,就出来一个“分享你我快乐生活”的开头画面就不播放了
]]>
</description>
</item><item>
<link>http://zyan.cc/post/362/#blogcomment1461</link>
<title><![CDATA[[评论] 利用Tokyo Tyrant构建兼容Memcached协议、支持故障转移、高并发的分布式key-value持久存储系统[原创]]]></title> 
<author>alxyrh &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Fri, 29 Aug 2008 16:06:33 +0000</pubDate> 
<guid>http://zyan.cc/post/362/#blogcomment1461</guid> 
<description>
<![CDATA[ 
	不成熟的东西
]]>
</description>
</item><item>
<link>http://zyan.cc/post/362/#blogcomment1526</link>
<title><![CDATA[[评论] 利用Tokyo Tyrant构建兼容Memcached协议、支持故障转移、高并发的分布式key-value持久存储系统[原创]]]></title> 
<author>manof &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Tue, 09 Sep 2008 11:06:30 +0000</pubDate> 
<guid>http://zyan.cc/post/362/#blogcomment1526</guid> 
<description>
<![CDATA[ 
	routerpipe<br/>2008-8-14 13:15<br/>flash是出来的，视频出不来，我看youku ku6 tudou youtube等都正常，就新浪无法观看,就出来一个“分享你我快乐生活”的开头画面就不播放了 <br/>============================<br/>我也是这样，一般是在SINA看到视频的标题，再到其它视频站上去搜索。<br/>我用的是ubuntu,firefox 3.x,flashblock
]]>
</description>
</item><item>
<link>http://zyan.cc/post/362/#blogcomment1570</link>
<title><![CDATA[[评论] 利用Tokyo Tyrant构建兼容Memcached协议、支持故障转移、高并发的分布式key-value持久存储系统[原创]]]></title> 
<author>神仙 &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Mon, 22 Sep 2008 02:01:42 +0000</pubDate> 
<guid>http://zyan.cc/post/362/#blogcomment1570</guid> 
<description>
<![CDATA[ 
	碰到一个麻烦，<br/>php上用tokyo tyrant，不会自动反序列化<br/>放了一个 array(1,2,3,4,5)，出来就是 &#039;a:5:&#123;i:0;i:1;i:1;i:2;i:2;i:3;i:3;i:4;i:4;i:5;&#125;&#039; 了
]]>
</description>
</item><item>
<link>http://zyan.cc/post/362/#blogcomment1601</link>
<title><![CDATA[[评论] 利用Tokyo Tyrant构建兼容Memcached协议、支持故障转移、高并发的分布式key-value持久存储系统[原创]]]></title> 
<author>小黑米 &lt;edwardhey@163.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Fri, 26 Sep 2008 01:13:46 +0000</pubDate> 
<guid>http://zyan.cc/post/362/#blogcomment1601</guid> 
<description>
<![CDATA[ 
	<br/>我也遇到和楼上的一样麻烦不过这个还好解决<br/><br/>不过我发现没办法设置过期时间 请问张大侠有遇到这个没
]]>
</description>
</item><item>
<link>http://zyan.cc/post/362/#blogcomment1656</link>
<title><![CDATA[[评论] 利用Tokyo Tyrant构建兼容Memcached协议、支持故障转移、高并发的分布式key-value持久存储系统[原创]]]></title> 
<author>wqm &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Sun, 19 Oct 2008 00:06:43 +0000</pubDate> 
<guid>http://zyan.cc/post/362/#blogcomment1656</guid> 
<description>
<![CDATA[ 
	一主多从应该怎么配置？<br/>谢谢！
]]>
</description>
</item><item>
<link>http://zyan.cc/post/362/#blogcomment2221</link>
<title><![CDATA[[评论] 利用Tokyo Tyrant构建兼容Memcached协议、支持故障转移、高并发的分布式key-value持久存储系统[原创]]]></title> 
<author>地热 &lt;jond715@sohu.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Fri, 12 Dec 2008 03:09:17 +0000</pubDate> 
<guid>http://zyan.cc/post/362/#blogcomment2221</guid> 
<description>
<![CDATA[ 
	受教了
]]>
</description>
</item><item>
<link>http://zyan.cc/post/362/#blogcomment2337</link>
<title><![CDATA[[评论] 利用Tokyo Tyrant构建兼容Memcached协议、支持故障转移、高并发的分布式key-value持久存储系统[原创]]]></title> 
<author>huaimin &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Mon, 29 Dec 2008 08:16:06 +0000</pubDate> 
<guid>http://zyan.cc/post/362/#blogcomment2337</guid> 
<description>
<![CDATA[ 
	持续写500万小数据， 写到200万数据左右，就开始写入出错，后面偶尔断断续续能写一些进去。不知道你遇到过没有，怎么能解决？
]]>
</description>
</item>
</channel>
</rss>