Skip to content

Commit 8860b66

Browse files
bug symfony#28249 [Cache] enable Memcached::OPT_TCP_NODELAY to fix perf of misses (nicolas-grekas)
This PR was merged into the 3.4 branch. Discussion ---------- [Cache] enable Memcached::OPT_TCP_NODELAY to fix perf of misses | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | symfony#28248 | License | MIT | Doc PR | - As described in php-memcached-dev/php-memcached#24 and because we enable the binary protocol by default. Commits ------- 8b59d17 [Cache] enable Memcached::OPT_TCP_NODELAY to fix perf of misses
2 parents d446b6a + 8b59d17 commit 8860b66

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

src/Symfony/Component/Cache/Tests/Adapter/MemcachedAdapterTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ public function testDefaultOptions()
8989

9090
$this->assertTrue($client->getOption(\Memcached::OPT_COMPRESSION));
9191
$this->assertSame(1, $client->getOption(\Memcached::OPT_BINARY_PROTOCOL));
92+
$this->assertSame(1, $client->getOption(\Memcached::OPT_TCP_NODELAY));
9293
$this->assertSame(1, $client->getOption(\Memcached::OPT_LIBKETAMA_COMPATIBLE));
9394
}
9495

src/Symfony/Component/Cache/Traits/MemcachedTrait.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ public static function createConnection($servers, array $options = array())
134134
$options = array_change_key_case($options, CASE_UPPER);
135135
$client->setOption(\Memcached::OPT_BINARY_PROTOCOL, true);
136136
$client->setOption(\Memcached::OPT_NO_BLOCK, true);
137+
$client->setOption(\Memcached::OPT_TCP_NODELAY, true);
137138
if (!array_key_exists('LIBKETAMA_COMPATIBLE', $options) && !array_key_exists(\Memcached::OPT_LIBKETAMA_COMPATIBLE, $options)) {
138139
$client->setOption(\Memcached::OPT_LIBKETAMA_COMPATIBLE, true);
139140
}

0 commit comments

Comments
 (0)