http://docs.libmemcached.org/memcached_behavior_set.html#memcached_behavior_number_of_replicas
<http://docs.libmemcached.org/memcached_behavior_set.html#memcached_behavior_number_of_replicas>
or
<http://docs.libmemcached.org/memcached_behavior_set.html#memcached_behavior_number_of_replicas>
http://search.cpan.org/~timb/Memcached-libmemcached-0.4406/lib/Memcached/libmemcached/memcached_behavior.pm#MEMCACHED_BEHAVIOR_NUMBER_OF_REPLICAS

Is that feature working in libmemcached?    I tried with Perl's
Memcached::libmemcached two different versions:

   - Version 0.3102 (with libmemcached-0.31 embedded)
   - Version 0.4406 (with libmemcached-0.44 embedded)

<http://docs.libmemcached.org/memcached_behavior_set.html#memcached_behavior_number_of_replicas>

and watching with Wireshark (and also reading from individual servers) I
only saw a writes to a single server.

use Memcached::libmemcached qw(:memcached_behavior_t );
use strict;
use warnings;

my $memc = Memcached::libmemcached->new;
$memc->memcached_server_add( 'localhost', 11211 );
$memc->memcached_server_add( 'localhost', 11212 );

# Also tried specifying 2 for number of replicas
$memc->memcached_behavior_set( MEMCACHED_BEHAVIOR_NUMBER_OF_REPLICAS() => 1
);
$memc->memcached_set( 'test', 1, 10 ) || die 'set failed ' . $memc->errstr;

Also, what does MEMCACHED_BEHAVIOR_SERVER_FAILURE_LIMIT do?  Does that mean
after a server reports that many failures any gets or sets to that server
will fail without the library attempting to send to the memcached server?  I
assume that doesn't mean the server will be pulled out of the pool and keys
would get rehashed to new servers.  (Although, maybe
if MEMCACHED_BEHAVIOR_AUTO_EJECT_HOSTS is set, but if that means keys would
hash to different servers that seems like a bad idea.)

Yes, I'm looking at poor-man's HA with these two features.  Looking at how
pulling the plug on one server won't result in get or set failures, and not
an increased amount of time (say waiting for a failed server to respond).



-- 
Bill Moseley
mose...@hank.org

Reply via email to