Dead host detection and remapping keys to other memcached servers

Brad Fitzpatrick brad@danga.com
Mon, 24 Nov 2003 10:10:37 -0800 (PST)


Well, the item won't exist in port 2048's cache the first time at least...
so you'll get at least one snafu with your code.  The second time it
should work.

(but the remapping code in the client isn't perfect... sometimes it gives
up after so many rehashings.  most the time it works, though...)


On Mon, 24 Nov 2003, Yusuf Goolamabbas wrote:

> Hi, Just came across memcached and am playing with it
> On a RH 9 box using libevent 0.7c (which uses poll) and memcached-1.1.9 with
> Cache::MemCached 1.11 and the following test program
>
> use Cache::Memcached;
> $memd = new Cache::Memcached {
>            'servers' => [ "127.0.0.1:2049" , "127.0.0.1:2048" ] ,
>            'debug' => 1,
>            'compress_threshhold' => 10000
>          };
> my $obj = $memd->get("foo");
> if ($obj) {
>   print "$obj \n" ;
> } else {
>   $memd->set("foo", "bar");
>   print "snafu\n" ;
> }
>
> The key is initally mapped to the server listening on port 2049, I
> expected that if I shut down 2049, then the Perl API would then add the
> key again on the server listening on port 2048 and subsequently the
> results would be read from memcache. However, this does not seem to be
> the case and until the 2049 server is started again, "snafu" keeps on
> getting printed
>
> Have I missed something obvious ?
>
> Regards, Yusuf
> --
> If you're not using Firebird, you're not surfing the web
>    you're suffering it
> http://www.mozilla.org/products/firebird/why/
>
>