-
Notifications
You must be signed in to change notification settings - Fork 321
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Slow cache misses using binary protocol #24
Comments
Try enabling Memcached::OPT_TCP_NODELAY - that completely fixed all empty key gets on my server. |
Thanks a lot, that fixed the problem. |
marczych
added a commit
to iFixit/Matryoshka
that referenced
this issue
Apr 3, 2015
This makes it so misses don't take several extra milliseconds. See php-memcached-dev/php-memcached#24.
marczych
added a commit
to iFixit/Matryoshka
that referenced
this issue
Apr 6, 2015
This makes it so misses don't take several extra milliseconds. See php-memcached-dev/php-memcached#24.
nicolas-grekas
added a commit
to symfony/symfony
that referenced
this issue
Aug 24, 2018
…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
symfony-splitter
pushed a commit
to symfony/cache
that referenced
this issue
Aug 24, 2018
…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 ------- 8b59d177db [Cache] enable Memcached::OPT_TCP_NODELAY to fix perf of misses
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello,
I was experimenting with php-memcached binary mode, and I noticed that my PHP script became very, very slow when I enabled the binary protocol. The server load went to near zero, indicating that something is just sitting and waiting while doing nothing at all. I managed to isolate the problem into a simple test case (see below). It turned out that an attempt to get() a non-existing key requires about 30 ms to complete. As soon as the binary protocol is turned off, response times are back to normal.
I'm on Ubuntu Server 12.04 (64-bit). The PHP script and the memcached server run on two seperate servers. Package versions are:
php5-memcached-1.0.2-2
libmemcached 0.44-1.1build1
memcached 1.4.13-0ubuntu2
I also tried to compile the latest memcached PECL from source, which did not make any difference.
A PHP script which reproduces the problem is shown below. Can anyone else reproduce this?
setOption(Memcached::OPT_BINARY_PROTOCOL, True); $Cache -> addServers(array ( array ("172.16.0.20","11211","0") )); $Counter = 0; $Start = time(); print("Getting 1000 Keys..."); while ($Counter < 1000) { $Cache -> get("test"); $Counter++; } $End = time(); $Speed = 1000.0 / ($End - $Start); print("Done, $Speed per second.\n");The text was updated successfully, but these errors were encountered: