Python memcached set_multi存储问题



我在尝试使用python-memcached存储大量键时发现了一个问题。下面是我正在做的:

import memcache
# This dict has a 2270 entries that is generated on production server
v = eval(open("/home/dragoon/output").read())
a = memcache.Client(['unix:/tmp/memcached.sock'], debug=1)

接下来我试着设置所有这些值:

In [94]: len(a.set_multi(v))                                       
MemCached: MemCache: unix:/tmp/memcached.sock: timed out.  Marking dead.
Out[94]: 2270

memcached服务器的日志输出:

...
27: going from conn_new_cmd to conn_parse_cmd
<27 set d750bde63a98579f9c2987907aaaf5f8 1 0 18
27: going from conn_parse_cmd to conn_nread
> FOUND KEY d750bde63a98579f9c2987907aaaf5f8
>27 STORED
27: going from conn_nread to conn_write
Failed to write, and not due to blocking: Broken pipe
27: going from conn_write to conn_closing
<27 connection closed.

一段时间后:

In [96]: len(a.set_multi({'test':1}))
Out[96]: 0
In [97]: a.get('test')
Out[97]: 1

默认超时是3秒,但即使增加到100秒也无济于事,memcached只是卡住了。所以,我的问题是,memcache的问题是什么?

我看到有人在谈论存储超过1000000个条目,但对我来说,它甚至不能存储2000个?

尝试使用pylibmc作为memcache驱动程序,而不是使用python-memcache

我在Ubuntu 11的Memcache 1.4.7上也看到了这个问题

好的。memcached 1.4.2 (Ubuntu 10.04 LTS的最后一个版本)似乎有一些错误。Memcached 1.4.5工作正常

相关内容

  • 没有找到相关文章

最新更新