Patrick Galbraith (capttofu) wrote,

Libmemcached increment and decrement issue solved

I spoke with Brian Aker last week about the issues I found with decrement and increment while working on my book "Developing Web Applications with Apache, MySQL, Memcached, and Perl". He suggested I make sure that I was using the latest libmemcached. I checked, and the version of libmemcached that is included with Memcached::libmemcached is 0.21 - this is the version of Memcached::libmemcached I obtained from using CPAN (perhaps CPAN needs a new bundle...). So, I obtained the most recent version of Memcached::libmemcached from the subversion repository at https://perl-libmemcached.googlecode.com/svn, and it includes the lastest libmemcached, version 0.25. To make a long story short, I re-wrote my test script to test each operation individualy and time that, as well as compare the times to Cache::Memcached. The numbers are great and are reason enough to use Memcached::libmemcached/Cache::Memcached::libmemcached:

http://www.patg.net/downloads/memtest.pl

The numbers it gave me are:

[patg@vidya perl]$ ./memtest.pl -l 1000
Operation  Cache::Memcached libmemcached   C::M/libmem %  libmem/C::M % 
set        0.083264         0.061046       136.40         73.32         
get        0.164471         0.054142       303.78         32.92         
replace    0.081321         0.060575       134.25         74.49         
increment  0.080247         0.056108       143.02         69.92         
decrement  0.07893          0.052921       149.15         67.05         
delete     0.07416          0.056302       131.72         75.92         
total      0.562456         0.341165       164.86         60.66         
[patg@vidya perl]$ ./memtest.pl -l 10000
Operation  Cache::Memcached libmemcached   C::M/libmem %  libmem/C::M % 
set        0.838437         0.63161        132.75         75.33         
get        1.676396         0.552247       303.56         32.94         
replace    0.846411         0.615959       137.41         72.77         
increment  0.812054         0.538519       150.79         66.32         
decrement  0.787005         0.532655       147.75         67.68         
delete     0.744186         0.515013       144.50         69.20         
total      5.7046           3.386127       168.47         59.36         
[patg@vidya perl]$ ./memtest.pl -l 100000
Operation  Cache::Memcached libmemcached   C::M/libmem %  libmem/C::M % 
set        8.436679         6.469707       130.40         76.69         
get        16.641089        5.553091       299.67         33.37         
replace    8.438474         6.239129       135.25         73.94         
increment  8.110361         5.765341       140.67         71.09         
decrement  8.272824         5.615784       147.31         67.88         
delete     7.648199         5.32153        143.72         69.58         
total      57.547827        34.964783      164.59         60.76



The heading C::M/libmem refers to the percentage Cache::Memcached::libmemcached of Cache::Memcached, and libmemc/C::M percentage Cache::Memcached of Cache::Memcached::libmemcached.

All operations where faster using libmemcached, particularly "get". Increment and decrement were both around 140-150% the speed of using Cache::Memcached.

So, problem solved.
Tags: libmemcached, memcached, performance, perl
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic
  • 0 comments