Comment 2 for bug 1158676

Revision history for this message
Brian Aker (brianaker) wrote : Re: [Bug 1158676] Re: ketama algorithm doesn't work?

Are you using weighting?

On Sun, Mar 24, 2013 at 7:27 PM, Denis Shashkov <email address hidden> wrote:

> ** Description changed:
>
> All software is self-builded: PHP 5.3.10 + memcached extension 2.1.0,
> linked with libmemcached 1.0.14.
> Running simple PHP-script:
> <?php
> $m = new Memcached();
> $m->setOption(Memcached::OPT_COMPRESSION, false);
> $m->setOption(Memcached::OPT_CONNECT_TIMEOUT, 10);
> $m->setOption(Memcached::OPT_RETRY_TIMEOUT, 1);
> // ketama options
> $m->setOption(Memcached::OPT_DISTRIBUTION,
> Memcached::DISTRIBUTION_CONSISTENT);
> $m->setOption(Memcached::OPT_LIBKETAMA_COMPATIBLE, true);
> $m->setOption(Memcached::OPT_SERVER_FAILURE_LIMIT, 1);
> $m->setOption(Memcached::OPT_REMOVE_FAILED_SERVERS, true);
>
> $servers = array();
> $servers[] = array('127.0.0.1', 11211, 100);
> $servers[] = array('192.168.0.1', 11212, 100);
> $m->addServers($servers);
>
> for ( $i=0; $i<100; $i++ ) {
> - sleep(1);
> - var_dump($m->set('key', 1));
> - if ($m->getResultCode() > 0) {
> - if ($m->getResultCode() !== Memcached::RES_NOTFOUND ) {
> - echo $m->getResultMessage().PHP_EOL;
> - }
> - }
> + sleep(1);
> + var_dump($m->set('key', 1));
> + if ($m->getResultCode() > 0) {
> + if ($m->getResultCode() !== Memcached::RES_NOTFOUND ) {
> + echo $m->getResultMessage().PHP_EOL;
> + }
> + }
> }
> ?>
>
> - After several successful cycles, dropping down second server
> (192.168.0.1).
> + After several successful cycles, dropping down second server
> (192.168.0.1).
> Expected behavior:
> 1. After dropping connection and polling timeout, server will be marked
> as FAULTY.
> 2. After first connecting attempt, server will be marked as DEAD.
> Memcached ext./libmemcached will redistribute key to first memcached server
> (127.0.0.1).
>
> Observed behavior:
> 1. After dropping connection and polling timeout, server is marked as
> FAULTY? (It's an assumption, cannot check).
> 2. Memcached ext./libmemcached open connection to first server
> (127.0.0.1), SUCCESSFULLY stores the key AND getResultMessage returns
> "SERVER IS MARKED DEAD". (It's normal)
> 3. At the next cycle, Memcached ext./libmemcached successfully stores
> the key. (It's normal, too)
> - 4. At the next and further cycles, Memcached ext./libmemcached return
> FALSE on set() operation and getResultMessage returns "SERVER IS MARKED
> DEAD".
> + 4. At the next and further cycles, Memcached ext./libmemcached return
> FALSE on set() operation and getResultMessage returns "SERVER IS MARKED
> DEAD".
>
> - It's hard confusing. Why just using first server further?
> + It's hard confusing. Why just not using first server further?
>
> I check memcached extension's sources and believe it pass ketama options
> to libmemcached well.
> - So I propose that unexpected behavior is a bug. Or maybe I use invalid
> option set with memcached extension/libmemcached?
> + So I propose that unexpected behavior is a bug. Or maybe I used invalid
> option set with memcached extension/libmemcached?
>
> --
> You received this bug notification because you are subscribed to
> libmemcached.
> https://bugs.launchpad.net/bugs/1158676
>
> Title:
> ketama algorithm doesn't work?
>
> Status in libmemcached - A C and C++ client library for memcached:
> New
>
> Bug description:
> All software is self-builded: PHP 5.3.10 + memcached extension 2.1.0,
> linked with libmemcached 1.0.14.
> Running simple PHP-script:
> <?php
> $m = new Memcached();
> $m->setOption(Memcached::OPT_COMPRESSION, false);
> $m->setOption(Memcached::OPT_CONNECT_TIMEOUT, 10);
> $m->setOption(Memcached::OPT_RETRY_TIMEOUT, 1);
> // ketama options
> $m->setOption(Memcached::OPT_DISTRIBUTION,
> Memcached::DISTRIBUTION_CONSISTENT);
> $m->setOption(Memcached::OPT_LIBKETAMA_COMPATIBLE, true);
> $m->setOption(Memcached::OPT_SERVER_FAILURE_LIMIT, 1);
> $m->setOption(Memcached::OPT_REMOVE_FAILED_SERVERS, true);
>
> $servers = array();
> $servers[] = array('127.0.0.1', 11211, 100);
> $servers[] = array('192.168.0.1', 11212, 100);
> $m->addServers($servers);
>
> for ( $i=0; $i<100; $i++ ) {
> sleep(1);
> var_dump($m->set('key', 1));
> if ($m->getResultCode() > 0) {
> if ($m->getResultCode() !== Memcached::RES_NOTFOUND ) {
> echo $m->getResultMessage().PHP_EOL;
> }
> }
> }
> ?>
>
> After several successful cycles, dropping down second server
> (192.168.0.1).
> Expected behavior:
> 1. After dropping connection and polling timeout, server will be marked
> as FAULTY.
> 2. After first connecting attempt, server will be marked as DEAD.
> Memcached ext./libmemcached will redistribute key to first memcached server
> (127.0.0.1).
>
> Observed behavior:
> 1. After dropping connection and polling timeout, server is marked as
> FAULTY? (It's an assumption, cannot check).
> 2. Memcached ext./libmemcached open connection to first server
> (127.0.0.1), SUCCESSFULLY stores the key AND getResultMessage returns
> "SERVER IS MARKED DEAD". (It's normal)
> 3. At the next cycle, Memcached ext./libmemcached successfully stores
> the key. (It's normal, too)
> 4. At the next and further cycles, Memcached ext./libmemcached return
> FALSE on set() operation and getResultMessage returns "SERVER IS MARKED
> DEAD".
>
> It's hard confusing. Why just not using first server further?
>
> I check memcached extension's sources and believe it pass ketama options
> to libmemcached well.
> So I propose that unexpected behavior is a bug. Or maybe I used invalid
> option set with memcached extension/libmemcached?
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/libmemcached/+bug/1158676/+subscriptions
>