Skip to content

Commit

Permalink
bug #28249 [Cache] enable Memcached::OPT_TCP_NODELAY to fix perf of m…
Browse files Browse the repository at this point in the history
…isses (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 | #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
  • Loading branch information
nicolas-grekas committed Aug 24, 2018
2 parents d446b6a + 8b59d17 commit 8860b66
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
Expand Up @@ -89,6 +89,7 @@ public function testDefaultOptions()

$this->assertTrue($client->getOption(\Memcached::OPT_COMPRESSION));
$this->assertSame(1, $client->getOption(\Memcached::OPT_BINARY_PROTOCOL));
$this->assertSame(1, $client->getOption(\Memcached::OPT_TCP_NODELAY));
$this->assertSame(1, $client->getOption(\Memcached::OPT_LIBKETAMA_COMPATIBLE));
}

Expand Down
1 change: 1 addition & 0 deletions src/Symfony/Component/Cache/Traits/MemcachedTrait.php
Expand Up @@ -134,6 +134,7 @@ public static function createConnection($servers, array $options = array())
$options = array_change_key_case($options, CASE_UPPER);
$client->setOption(\Memcached::OPT_BINARY_PROTOCOL, true);
$client->setOption(\Memcached::OPT_NO_BLOCK, true);
$client->setOption(\Memcached::OPT_TCP_NODELAY, true);
if (!array_key_exists('LIBKETAMA_COMPATIBLE', $options) && !array_key_exists(\Memcached::OPT_LIBKETAMA_COMPATIBLE, $options)) {
$client->setOption(\Memcached::OPT_LIBKETAMA_COMPATIBLE, true);
}
Expand Down

0 comments on commit 8860b66

Please sign in to comment.