Comment 3 for bug 1158676

Revision history for this message
Denis Shashkov (bruzh2) wrote : Re: ketama algorithm doesn't work?

> Are you using weighting?

Yes, I do.
In the PHP code above I fill the $server array and use equal server weight = 100 (third value in array()).
There is that part:
$servers = array();
$servers[] = array('127.0.0.1', 11211, 100);
$servers[] = array('192.168.0.1', 11212, 100);
$m->addServers($servers);

Also I check second method to initialize server list:
$m->addServer('127.0.0.1', 11211, 100);
$m->addServer('192.168.0.1', 11212, 100);

In memcached extension, first method (addServers) calls memcached_server_list_append_with_weight() in libmemcached. Second one (addServer) calls memcached_server_add_with_weight().

But observed behavior is not changes in general:
1. After dropping server 192.168.0.1 and polling timeout, it's connection (socket #5 in strace2.log) is shutted down. Key is successfully stored to server 127.0.0.1 (socket #4) and getResultMessage returns "SERVER IS MARKED DEAD".
2. At the next cycle, Memcached ext./libmemcached also successfully stores the key to rest server 127.0.0.1
3. At the next and further cycles, Memcached ext./libmemcached return FALSE on set() operation and getResultMessage returns "SERVER IS MARKED DEAD".

I'm not sure that behavior assumes a bug in libmemcached. But I cannot explain for self why memcached extension and libmemcached successfully uses live server two times and not uses it further.