-
Notifications
You must be signed in to change notification settings - Fork 374
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
[QUESTION]: Why is Ristretto so slow and has such a small hit ratio? #363
Comments
In your graph, tests are run using
So I assume that this might be the reason. I look forward to see your updated tests result. |
Unfortunately, this is not how it works. |
Everything indicates at the moment that the latest versions of ristretto have very serious bugs that have not been fixed for a long time. (everything is fine with hit ratio on v0.0.2). |
There's a thing in ristretto called |
Oh my God, I realized what happened and it's not good at all. The fact is that at some point ristretto added the IgnoreInternalCost flag to its config. This led to the fact that all its clients (which specified cost = 1) broke down. Moreover, they even broke their tests. And I have not seen the use of
Unfortunately, this is not a common scenario and you do not understand the size of the cache. Yes, hit ratio performance improves with this flag but it still does not give ristretto the opportunity to fight against the canonical W-TinyLFU. But the throughput has decreased significantly and now ristretto loses ccache on some types of load.
I will try to update the README in otter soon and ideally I need to come with a pull request to ristretto of course but I doubt that this will fix anything with the current level of support. |
This issue has been stale for 60 days and will be closed automatically in 7 days. Comment to keep it open. |
Still applicable. |
I recalculated the benchmark results with the updated ristretto configuration, and also added gcache, ttlcache and golang-lru. The results look quite plausible. It's only necessary to make a reservation that the ristretto memory usage may be less than the rest in reality, since ristretto uses a dirty hack and doesn't store keys. I will try to update the README in the next couple of days. P.S. I'm very sorry for the long delay :( |
Question.
Hi, I am currently writing a similar package and tried to compare my implementation https://github.com/maypok86/otter with Ristretto. In the end I found that Ristretto loses very badly (about 5-7 times) and has a hit ratio on most traces around zero. I can roughly understand why there is a terrible loss in speed (Ristretto even though it says it is contention-free, it actually locks its shards very often which ends up not giving enough perfomance to fight Otter).
I attached benchmarks with the best cache libraries at the moment.
But I would still like to hear an answer about the small hit ratio in Ristretto because in README there are some numbers but in practice they are around 0. This was also asked here and remained unanswered😢
I also attach the results of my hit ratio calculations, it seems several people and different benchmark implementations can't be wrong...😔
The text was updated successfully, but these errors were encountered: