Hi to all, I'm a new in a list.
This last days i spend some time thinking about how memcache - client
side - do some failover strategie in one pool of memcached servers.
Yes I have read the FAQ of memcached and this comment a lot of thinks
about memcached and that tool is not a distributed system, hence it's
responsability of client side build a "consistent" cache architecture,
but php and python - pure lib clients without linking to libmemcache -
have been written for memcache team, can you help me with next
question ?
At first time I thought client api used some easy approximation to
build one "failover" hash strategy to avoid some connect errors, for
example :
server = hash(key) % n_servers
while( connect(server, ...) AND i < max_retries )
{ i++; server++; }
But I was wrong, php and python client using a different concept like
to this :
server = hash(key);
while( connect(server % n_servers, ...) AND i < max_retries )
{
i++;
server += hash(key + str(i)) ;
}
This kind of approximation can has a dont expected behaviour, all
server values in all iteration can be projected in same integer range
and only try to connect a subgroup of server pool more lesser than all
group.
Python and php hash strategies are different, one plus string value at
end of hash value and the other plus string at init of hash with some
rotate bit tricks, but in definitely all of them have the same
behavior.
What do you think about is ?