201312-30 一致性hash的理解 1704 VIEW 一。 以前的%算法属于硬hash。在机器发生增减的时候,会有重新hash的问题。 二。Memcache的客户端引入了另一种hash算法:一致性hash: 1.映射 1)将对象与Cache使用同一hash算法映射到了同一个0~2的32次-1的环中(假设环的首尾相连) 2)将环中的对象顺时.... Read More >
201312-30 memcache分布式,一致性hash算法的php实现 1795 VIEW 最近在看一些分布式方面的文章,所以就用php实现一致性hash来练练手,以前一般用的是最原始的hash取模做分布式,当生产过程中添加或删除一台memcache都会造成数据的全部失效,一致性hash就是为了解决这个问题,把失效数据降到最低,相关资料可以google一下! php实现效率有一定的缺失,如果要高效率,还是写扩展比较好 经测试,5个memcache,每个memcache生成100个虚拟.... Read More >
201211-08 CentOS下yum安装MemCached 1762 VIEW 查找相关软件包 yum search memcache 有了,现在可以安装了 yum -y install –enablerepo=rpmforge memcached php-pecl-memcache 验证一下安装结果 memcached -h php -m|grep memcache 启动memcached /sbin/servive memcached start.... Read More >
201210-29 Python中使用Memcache 2155 VIEW 安装 python memcache 过程略 1 root@Veda:~# python 2 Python 2.7.2+ (default, Oct 4 2011, 20:03:08) 3 [GCC 4.6.1] on linux2 4 Type "help", "copyright", "credits" or.... Read More >