-
Notifications
You must be signed in to change notification settings - Fork 454
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
read_multi 50x slower when one of the keys is not found #106
Comments
Can't reproduce:
|
Sorry, wrong account :-) |
FWIW, I can reproduce this on my machine running gentoo linux, ruby 1.9.2-p290, dalli 1.0.5 and memcached 1.4.5. I rewrote the original example script: https://gist.github.com/1103725 Results were all over the place, but here's two typical runs:
Then I rewrote that to use ruby-prof, but I didn't see anything exceedingly obvious. Script: https://gist.github.com/1103732
|
I could reproduce it on Ubuntu 10.4 (linux 2.6.32-33), with dalli 1.0.5, memcached 1.4.2 and 1.4.6, ruby 1.8.7REE and ruby 1.9.2. When playing around with different configurations I noticed that the slowdown of the 'missing-key-multi-get' fluctuated between a 10x to 60x performance decrease. A colleague using a Mac saw consistently good performance. Could it be connected to the combination of Linux and Dalli? |
These times would indicate that ruby is just blocking on I/O, possibly implying that the issue is on the server-side. Can you reproduce it with other clients? |
Yes. Here's a version of the benchmark script using the memcache gem instead: https://gist.github.com/1106068 I know running things once or twice doesn't mean anything statistically, but the memcache version has no unusual slowdown in the missing key case:
|
Pete, your benchmark works perfectly for me against HEAD and with the Dalli 1.0.4 gem. Still can't reproduce - one of you will have to track down where that time goes. |
I found the benchmark depends on if memcached server is remote or local. I can reproduce it if memcached server at localhost. |
Can one of you hook up perftools.rb, run with the profiler, generate a call graph GIF and post it here?
|
Thanks for your time. |
That graph says that memcached or your machine is the slow factor, not Dalli. On Sep 27, 2011, at 0:45, orslumenreply@reply.github.com wrote:
|
I can reproduce this too (ubuntu) |
Try removing the kgio gem and see if that makes a difference. |
Already tried that last week. Did not help... |
tried it, it does not depend on kgio |
It's looking more and more like this is an issue with older memcached server versions. 1.4.8 has a bug fix for multi-get processing and I can't reproduce this on newer versions of memcached. It probably works with memcache-client because it uses the text protocol, not binary. Could people upgrade their memcached server version and see if the issue goes away? |
I have reproduced this on Memcached 1.4.13 with Libevent 2.0.17. Using REE and Ubuntu 10.04.3 |
@timhaines Does it happen on 1.9.3? |
Just tried it - no. The problem goes away on 1.9.3. |
I can also confirm that the problem disappears with Dalli 2.2.1 + ruby 1.9.3. Note that Dalli 1.1.5 + ruby 1.9.3 is still slow on Ubuntu (not as slow as with ree 1.8.7 though). |
Is anyone still able to repro this? I fixed some multi_get performance issues on master recently that are triggered when using large memcached server pools. |
We had this problem and it was caused by Nagle's algorithm; it went away when we set |
If all keys are present, the read_multi call is very fast. But surprisingly, when one of the requested keys is missing, it becomes more than 50x slower, see example below. The
memcache-client
gem does not have that problem.I found that the time is spend in memcached itself, so I upgraded to the latest version (1.4.6) but that does not help.
I think the problem is in the way Dalli communicates with memcached.
The following example assumes Rails is loaded in the IRB
The text was updated successfully, but these errors were encountered: