diff --git a/lib/private/Memcache/MemcachedFactory.php b/lib/private/Memcache/MemcachedFactory.php index e829c72af65ea..bc160c5ef310f 100644 --- a/lib/private/Memcache/MemcachedFactory.php +++ b/lib/private/Memcache/MemcachedFactory.php @@ -33,11 +33,13 @@ public function init(): void { $this->instance = new \Memcached(); $defaultOptions = [ - \Memcached::OPT_CONNECT_TIMEOUT => 50, - \Memcached::OPT_RETRY_TIMEOUT => 50, - \Memcached::OPT_SEND_TIMEOUT => 50, - \Memcached::OPT_RECV_TIMEOUT => 50, - \Memcached::OPT_POLL_TIMEOUT => 50, + // Set connect and polling timeouts to 500 milliseconds + \Memcached::OPT_CONNECT_TIMEOUT => 500, + \Memcached::OPT_POLL_TIMEOUT => 500, + + // Set send and receive timeouts to 500000 microseconds + \Memcached::OPT_SEND_TIMEOUT => 500000, + \Memcached::OPT_RECV_TIMEOUT => 500000, // Enable compression \Memcached::OPT_COMPRESSION => true, @@ -47,6 +49,9 @@ public function init(): void { // Enable Binary Protocol \Memcached::OPT_BINARY_PROTOCOL => true, + + // Disable Nagle algorithm to speed up connection + \Memcached::OPT_TCP_NODELAY => true, ]; /** * By default enable igbinary serializer if available