memcache client very slow?

Case 1: Ruby + Ruby-MemCache + onboard memcache (the cache) - 10.5 seconds

Case 2: Python + REMOTE memcache (the same cache as the other) - 0.2 seconds

Please please tell me I’m doing something very wrong… - and examples of the right way would be great.

m

Case 1: Ruby + Ruby-MemCache + onboard memcache (the cache) - 10.5 seconds

Case 2: Python + REMOTE memcache (the same cache as the other) - 0.2seconds

Please please tell me I'm doing something very wrong... - and examples of the right way would be great.

Try memcache-client instead...

http://dev.robotcoop.com/Libraries/memcache-client/index.html

It's supposed to be a lot faster...

Also, if this is on a mac and you're using memcache 1.2.0 recompile it and tweak the following:

# edit memcached.h and add '#undef NO_TCPPUSH' to the top

Can't remember where exactly I read that, but it makes a huge difference.

Well, the python-memcache was 50x faster, got it down to only 4x faster w/ memcache-client as suggested.

Two other things I’ve noticed:

  1. Python is much more stable - I very rarely get any kind of corruption or unexpected behavior - I’ve had to start over 5 times w/ ruby’s memcache.
  2. Ruby seems to care much more about marshaling, etc. Python seems quite happy to let you leave things as strings and do your own parsing.

Am I insane to consider trying to figure out how to use a python library in ruby? Is there such a thing? Or perhaps I should use a ReST API hosted by python, available from ruby - http://localhost:11212/search?key='red’ (and in fact I’m only going to be GETing from ruby - doing all the bulk cache loading on the python side thanks very much).

Any other suggestions?

m