Introducing Cache::Memcached::LibMemcached

lestrrat on 2008-01-15T23:25:38

Last weekend, in seeing a blog post (note, it's in Japanese), I realized that while there is a version being developed by Tim Bunce, nobody had written a Cache::Memcached compatible interface to libmemcached.

Ah well there is one now. It's now available on CPAN

I'm really glad I wrote it, libmemcached is blazing fast!

Here's the output of running the benchmark included with the distro on my laptop:

  daisuke@beefcake Cache-Memcached-LibMemcached$ perl -Mblib tools/benchmark.pl
  ==== Benchmark "Simple get() (scalar)" ====
                  Rate  perl_memcahed memcached_fast   libmemcached
  perl_memcahed  3837/s             --           -80%           -88%
  memcached_fast 18939/s           394%             --           -42%
  libmemcached   32895/s           757%            74%             --
  ==== Benchmark "Simple get() (w/serialize)" ====
                    Rate  perl_memcahed memcached_fast   libmemcached
  perl_memcahed   3658/s             --           -77%           -84%
  memcached_fast 16077/s           340%             --           -29%
  libmemcached   22727/s           521%            41%             --
  ==== Benchmark "Simple get() (w/compression)" ====
                    Rate  perl_memcahed memcached_fast   libmemcached
  perl_memcahed   3720/s             --           -74%           -81%
  memcached_fast 14535/s           291%             --           -27%
  libmemcached   19841/s           433%            37%             --
  ==== Benchmark "Simple set() (scalar)" ====
                    Rate  perl_memcahed memcached_fast   libmemcached
  perl_memcahed   7163/s             --           -61%           -77%
  memcached_fast 18519/s           159%             --           -41%
  libmemcached   31447/s           339%            70%             --
  ==== Benchmark "Simple set() (w/serialize)" ====
                   Rate  perl_memcahed memcached_fast   libmemcached
  perl_memcahed  3529/s             --           -31%           -41%
  memcached_fast 5086/s            44%             --           -15%
  libmemcached   6002/s            70%            18%             --
  ==== Benchmark "Simple set() (w/compress)" ====
                    Rate  perl_memcahed   libmemcached memcached_fast
  perl_memcahed   6684/s             --           -39%           -63%
  libmemcached   10989/s            64%             --           -39%
  memcached_fast 17986/s           169%            64%         --

Of course, there are some loose ends. First, there's that last benchmark entry (set w/compression) where Cache::Memcached::Fast is faster than libmemcached. I haven't really looked into it. Also, I haven't implemented stat() and the various libmemcached-specific stuff like consistent hashing, mostly because I've run out of tuits for now. Patches and/or comments are welcome. the svn repository is at

http://svn.coderepos.org/share/lang/perl/Cache-Memcached-LibMemcached/trunk