六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 154|回复: 0

memcache proxy magent

[复制链接]

升级  69.33%

42

主题

42

主题

42

主题

秀才

Rank: 2

积分
154
 楼主| 发表于 2013-2-7 05:24:40 | 显示全部楼层 |阅读模式
magent is a simple but useful proxy program for memcached servers.

It features:
keeps connections to memcached servers
supports following memcached commands
get gets
delete
incr decr
add set replace prepend append
cas
event-driven by using libevent library
supports ketama algorithm
backup servers farm
unix domain socket

http://code.google.com/p/memagent/

使用proxy 和未使用proxy 性能对比,未开启 ketama key allocation algorithm
测试环境
                                /  memcache 1
proxy ------------------
                                \  memcache 2


mc = memcache.Client(["memcache"])... n = time.time()... for i in xrange(100):...     mc.set("%s" % i * 10,i)...     ... for i in xrange(100):...     mc.get("%s" %  i * 10 )... ... print time.time() - n0.7 - 0.923: 99>>> mc = memcache.Client(["proxy"])... n = time.time()... for i in xrange(100):...     mc.set("%s" % i * 10,i)...     ... for i in xrange(100):...     mc.get("%s" %  i * 10 )... ... print time.time() - n0.9 - 1.124: 99

使用proxy 和未使用proxy 性能对比,开启ketama key allocation algorithm
mc = memcache.Client(["proxy"])... n = time.time()... for i in xrange(100):...     mc.set("%s" % i * 10,i)...     ... for i in xrange(100):...     mc.get("%s" %  i * 10 )... ... print time.time() - n0.946000099182 - 1.175: 99

通过开启一致性哈希测试2台cache key的分布并不均匀 ,需要增加更多的memcache节点。
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表