Memcached on Solaris
If you observe memcached exhibiting strange behavior while running under Solaris, you should try upgrading to the latest version of libevent.
I experienced a problem while testing my application on the excellent Joyent Facebook Accelerator, which runs Solaris Nevada snv_67 X86, has memcached 1.2.2 with libevent 1.3b2 installed by default.
My memcached usage is pretty low and I refresh the cache often to keep it from going stale, but somehow I still get lots of cache misses. By elimination, I ruled out the possibility of faults on the python memcache module, or memcached version (tried the latest 1.2.4 compiled against the libevent-1.3b2 and it still had the same problem.) When I connected my app to the memcached instance running on my FreeBSD box, though, the problem doesn’t exist.
Eventually, it turns out that memcached disconnects the client and all I got from the python memcache module was:
File "/opt/local/lib/python2.5/site-packages/memcache.py", line 846, in recv
'read returned 0 length bytes' % ( len(buf), foo ))
Well, that’s another bug. The above foo should really be rlen, but fixing that only proved that memcached always disconnects the client after sending 66887 bytes in response to a get.
After some poking around (by inserting prints and running memcached in foreground mode), it was apparent to me that memcached was getting an error from libevent, so I upgraded libevent and problem was solved.
Hope this helps anyone who may run into the same problem (as I couldn’t find any clue in the googs.)