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
serves => [ "10.0.0.15:11211", "10.0.0.15:11212", "/var/sock/memcached" ],
Re:Typo
lestrrat on 2008-01-16T03:08:05
Ah, thanks! Will be fixed in the next release.
I only discovered your module after I was well into the development of mine. My Memcached::libmemcached module has a different focus to yours. It aims to be a complete interface to the (feature rich) libmemcached library, while also being very fast.
I always figured that there would be a separate module layered over it to provide a Cache::Memcached compatible interface.
Once Memcached::libmemcached gains sufficient features perhaps you'd consider refactoring your module to use Memcached::libmemcached underneath. Tim.
Re:Memcached::libmemcached
lestrrat on 2008-01-16T12:30:28
I personally have no problem going that route, the only reason I took the other route is because I didn't know if Module::libmemcached was going to be released any time soon. I figured you might eventually come around to releasing it, but at the same time I wanted to try to see just how good libmemcached was, like, now:)
I suppose the only concern I have is just how much impact it would have as far as performance goes, to have another layer between Cache::Memcached::LibMemcached and libmemcached.Re:Memcached::libmemcached
Tim Bunce on 2008-01-16T15:28:47
Great.Re performance, I think I have a reputation for being paranoid about performance
:)
We'll have to see how things work out in practice.Meanwhile I'm glad your module exists as it takes the pressure off me to support the Cache::* API in the short term. Thanks.