memcache proxy magent

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节点。


你可能感兴趣的:(python,socket,unix,memcached,Google)