Perl client rewrite (2.0-rc1)

Cahill, Earl ecahill at corp.untd.com
Fri Jan 20 21:28:36 UTC 2006


By the by, not sure if anyone was running the code I included, but I
wasn't sure how to test set exactly, so my test creates lots of
different keys.  You will likely want to restart your memcached before
and after the test.

Earl

-----Original Message-----
From: memcached-bounces at lists.danga.com
[mailto:memcached-bounces at lists.danga.com] On Behalf Of Cahill, Earl
Sent: Thursday, January 19, 2006 6:53 PM
To: Gerard Goossen; memcached at lists.danga.com
Subject: RE: Perl client rewrite (2.0-rc1)

Well, played around a bit, and I would conclude that gets are faster,
but that might be about it.  In my benchmarks, which went to a remote
box, incr, decr, set, and set/delete cycles were all faster on the old
code (1.14).

But being as we have a 98% cache hit rate or so, I am all for faster
gets.

Earl

--old--
Benchmark: running incr for at least 2 CPU seconds...
      incr: 11 wallclock secs ( 1.39 usr +  0.62 sys =  2.01 CPU) @
8994.03/s (n=18078)
Benchmark: running decr for at least 2 CPU seconds...
      decr: 11 wallclock secs ( 1.51 usr +  0.77 sys =  2.28 CPU) @
9429.39/s (n=21499)
Benchmark: running get for at least 2 CPU seconds...
       get:  6 wallclock secs ( 1.67 usr +  0.36 sys =  2.03 CPU) @
3862.07/s (n=7840)
Benchmark: running set for at least 2 CPU seconds...
       set: 10 wallclock secs ( 1.38 usr +  0.79 sys =  2.17 CPU) @
9046.08/s (n=19630)
Benchmark: running set_delete for at least 2 CPU seconds...
set_delete:  9 wallclock secs ( 1.45 usr +  0.71 sys =  2.16 CPU) @
4354.63/s (n=9406)


--new--
Benchmark: running incr for at least 2 CPU seconds...
      incr:  9 wallclock secs ( 1.70 usr +  0.40 sys =  2.10 CPU) @
7972.86/s (n=16743)
Benchmark: running decr for at least 2 CPU seconds...
      decr: 10 wallclock secs ( 1.60 usr +  0.45 sys =  2.05 CPU) @
8143.90/s (n=16695)
Benchmark: running get for at least 2 CPU seconds...
       get:  8 wallclock secs ( 1.71 usr +  0.40 sys =  2.11 CPU) @
6563.98/s (n=13850)
Benchmark: running set for at least 2 CPU seconds...
       set:  7 wallclock secs ( 1.62 usr +  0.48 sys =  2.10 CPU) @
7370.00/s (n=15477)
Benchmark: running set_delete for at least 2 CPU seconds...
set_delete:  8 wallclock secs ( 1.62 usr +  0.47 sys =  2.09 CPU) @
3507.18/s (n=7330)

--code snippet--
use Benchmark qw(timethese);
use Time::HiRes qw(gettimeofday);

use Cache::Memcached;

my $mc = Cache::Memcached->new({
    servers   => $MEMCACHE_SERVER,
});

my $incr = 'incr';
$mc->set($incr, 1);

timethese(-2, { incr => sub { $mc->incr($incr) }, });

$mc->set($incr, $mc->get($incr) * 2);
timethese(-2, { decr => sub { $mc->decr($incr) }, });

my $key = 'key';
$mc->set($key, time);

timethese(-2, { get => sub { $mc->get($key) }, });
timethese(-2, { set => sub { $mc->set(gettimeofday, 1) }, });
timethese(-2, { set_delete => sub { my $key =
gettimeofday;$mc->set($key, 1);$mc->delete($key) }, });

$mc->delete($key);


-----Original Message-----
From: memcached-bounces at lists.danga.com
[mailto:memcached-bounces at lists.danga.com] On Behalf Of Gerard Goossen
Sent: Thursday, January 19, 2006 10:51 AM
To: memcached at lists.danga.com
Subject: Perl client rewrite (2.0-rc1)

Hi,

We have rewritten the perl memcached client.
New features:
- Faster (about twice as fast).
- UTF-8 supported.
- tests.
- We can read the code
- More documentation

We have been running the new clients one our servers for a few weeks
without any (memcached related) problems.
I should work as a drop in replacement for the current perl client.
But it would be nice, if some more people could test it.
There is still room for some more performance improvements, but it would
be nice to know that everything works (outside the universe of our few
server), before doing that.

http://dev.tty.nl/memcached/Cache-Memcached-2.0-rc1.tar.gz

Gerard Goossen & Harm Bus


More information about the memcached mailing list