首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

依据用户IP调度不同节点之哈希散列方式

2012-10-29 
根据用户IP调度不同节点之哈希散列方式php一致性hash类下载地址:http://code.google.com/p/flexihash/ ??

根据用户IP调度不同节点之哈希散列方式

php一致性hash类下载地址:http://code.google.com/p/flexihash/

?

<?require_once 'flexihash.php'; $hostArr = array('img1.marx.com','img2.marx.com','img3.marx.com','img4.marx.com','img5.marx.com','img6.marx.com',...);$hash = new Flexihash();$hash->addTargets($hostArr);$src = $_SERVER['REMOTE_ADDR'];echo $hash->lookup($src);

?

?

分布的均匀程度与节点数的多少有关系, 节点越多, 分布越均匀。

?

可以做一个测试看看。

热点排行