论坛首页 综合技术论坛

memcache proxy magent

浏览 1684 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2011-03-07   最后修改:2011-03-07
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() - n
0.7 - 0.9
23: 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() - n
0.9 - 1.1
24: 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() - n
0.946000099182 - 1.1
75: 99


通过开启一致性哈希测试2台cache key的分布并不均匀 ,需要增加更多的memcache节点。


论坛首页 综合技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics