From 01c20412745c18071867e8b9a9e775e1aade1a8d Mon Sep 17 00:00:00 2001 From: Mat Meredith Date: Wed, 8 Nov 2017 07:56:29 +0000 Subject: [PATCH 1/2] Make timeout half the length of that used by Sprout / Homestead to allow for retries --- src/memcached_backend.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/memcached_backend.cpp b/src/memcached_backend.cpp index 7ee1b26..527b4da 100644 --- a/src/memcached_backend.cpp +++ b/src/memcached_backend.cpp @@ -58,7 +58,7 @@ MemcachedBackend::MemcachedBackend(MemcachedConfigReader* config_reader, // timeout because libmemcached tries to connect to all servers sequentially // during start-up, and if any are not up we don't want to wait for any // significant length of time. - _options = "--CONNECT-TIMEOUT=10 --SUPPORT-CAS --POLL-TIMEOUT=250 --BINARY-PROTOCOL"; + _options = "--CONNECT-TIMEOUT=10 --SUPPORT-CAS --POLL-TIMEOUT=50 --BINARY-PROTOCOL"; // Create an updater to keep the store configured appropriately. _updater = new Updater(this, std::mem_fun(&MemcachedBackend::update_config)); From e2e87799c56d0a88e8bfd70f87415045bf9752c2 Mon Sep 17 00:00:00 2001 From: Mat Meredith Date: Wed, 8 Nov 2017 08:06:45 +0000 Subject: [PATCH 2/2] Add comment --- src/memcached_backend.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/memcached_backend.cpp b/src/memcached_backend.cpp index 527b4da..755a4ac 100644 --- a/src/memcached_backend.cpp +++ b/src/memcached_backend.cpp @@ -58,6 +58,10 @@ MemcachedBackend::MemcachedBackend(MemcachedConfigReader* config_reader, // timeout because libmemcached tries to connect to all servers sequentially // during start-up, and if any are not up we don't want to wait for any // significant length of time. + // Note that the poll timeout needs to be at most half the timeout used by + // the MemcachedStore (i.e. Sprout / Homestead when sending requests to us) + // to give us time to try a second replica if the request to the first replica + // times out. _options = "--CONNECT-TIMEOUT=10 --SUPPORT-CAS --POLL-TIMEOUT=50 --BINARY-PROTOCOL"; // Create an updater to keep the store configured appropriately.