Updating Memcached on Ubuntu Jaunty

I’ve been working with memcache-related things lately and ran into a problem where the library I was using just didn’t seem to do what its documentation said it would. It turned out that it was making a “gets” call rather than a “get” call – and this functionality wasn’t introduced to memcached until version 1.2.4. Closer inspection shows that although Ubuntu Jaunty Jackalope (9.04) is only a few months old, and memcached 1.2.4 is about 18 months old, its not included and Ubuntu versions Hardy, Intrepid and Jaunty all had 1.2.2 version of memcached.

Credit to the Ubuntu people for resolving this issue already – since memcached 1.2.8 is currently pencilled in for Karmic Koala release of Ubuntu later this year – but I can’t wait that long so I updated my own memcached, it was pretty easy so here are the steps in case anyone else wants to do the same.

  1. download memcached from http://www.danga.com/memcached/download.bml
  2. check you have the dependencies you need. The only thing I didn’t have was the libraries for libevent, which you can install through aptitude with aptitude install libevent-dev
  3. compile as you usually would: configure/make/make install

The final step is to get memcached running – I actually did aptitude remove memcached to get rid of my old version and stop myself from being confused later. Then to start it from command line I used:

/usr/local/bin/memcached -m 64 -p 11211 -u nobody -l 0.0.0.0

The above worked for me and allowed me to use the functionality available in the newer library (specifically I was looking to use the cas (compare and swap) functionality in the new PHP memcached extension) – it probably works on other distros too but I didn’t test it, if it works for you or if you have anything to add then please leave a comment!

3 thoughts on “Updating Memcached on Ubuntu Jaunty

  1. I’ve also heard complaints that the Jaunty bundled memcached is compiled as single-threaded.

    I’ve complained about Ubuntu’s memcached packages before in their bug system, but didn’t get much traction. One of the many reasons I don’t use Ubuntu anymore.

    Fedora 11 memcached is version 1.2.8, yay! :)

  2. Did you have a chance to go to Andre’s all the little pieces talk at DPC? I learned a lot about memcache’s slabs, storage bits, multipliers and such there, so I think I’m in a way better position to configure it properly.

  3. LinuxJedi: I am not using it in production so haven’t run into those issues (yet), thanks for the update though.

    Paul: I didn’t see that talk, sounsd like I missed out. Since I don’t run production platforms for a living these days, I don’t have much need to work with memcache in anger, but I’d be very interested to know how you get on with it.

Leave a Reply

Please use [code] and [/code] around any source code you wish to share.

This site uses Akismet to reduce spam. Learn how your comment data is processed.