Skip to content
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 performance with ohm/redis #73

Closed
gingerlime opened this issue Oct 4, 2012 · 6 comments
Closed

slow performance with ohm/redis #73

gingerlime opened this issue Oct 4, 2012 · 6 comments

Comments

@gingerlime
Copy link

Already posted this question on stackoverflow, but thought I should ask here too, just in case. Hope someone can point us in the right direction?

We're scratching our heads the last couple of days trying to understand why some things seem a bit too slow with redis/ohm on our rails project.

The gist of it is that some requests to ohm/redis take around 100-200 ms, which seem rather high considering our high-expectations of blazing-fast performance.

The command we're running looks like:

Stats::TermStats.find(term_slug: 'term_slug', user_id: 123).to_a

It seems to us that we're not doing anything extremely complex or crazy. Our profiling (using miniprofiler) of this single command so far revealed the following:

  • Some of those calls complete within about 2-4 ms (is this ok/good/bad?)
  • Some however take 100-200 ms (this definitely feels bad)
  • Using slowlog get on the redis-client does not show anything particularly slow on redis. Most of the redis command complete within less than 20 microseconds (0.02 ms)
  • Using the rails console and running a quick benchmark using the exact same slug/id in a loop, the same behaviour is observed, i.e. a few of those (same) requests seem to take considerably longer than most others

Our redis config is pretty much out-of-the-box with basically no tweaking. During testing the server is not doing much else.

Any suggestions how to improve performance / test what slows down things so much between redis and ohm/rails ??

@gingerlime
Copy link
Author

Just in case anybody's interested, we think we have found the cause for this problem, and even a solution

TL;DR : use hiredis + tune the ruby GC parameters.

@frodsan
Copy link
Contributor

frodsan commented Dec 17, 2013

Ohm 2 uses Redic instead of redis-rb. Redic uses hiredis, as a hard dependency, for the connection and for parsing the replies. It will be nice if you could try this with new versions of Ohm and re-open it to discussion if performance remains a problem. /cc @soveran can you close it?

@gingerlime
Copy link
Author

This sounds interesting. Thanks @frodsan. Do you expect to see a difference between using Redic and redis-rb with hiredis?

@frodsan
Copy link
Contributor

frodsan commented Dec 17, 2013

There is a section called "Differences with redis-rb" in the README.

@soveran
Copy link
Owner

soveran commented Jan 8, 2014

@gingerlime Would it be OK if I we close this issue? I think it is solved in Ohm 2, but I'll wait for your +1.

@gingerlime
Copy link
Author

I haven't had a chance to play around with Ohm 2 or redic, but sounds like this issue can be closed. Really glad to see things improving! Hope to find some time to test / compare, but not sure when.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants