-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
fix(grouping): Fix grouphash caching metric cache expiry tagging #104537
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
fix(grouping): Fix grouphash caching metric cache expiry tagging #104537
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #104537 +/- ##
===========================================
- Coverage 80.63% 80.52% -0.12%
===========================================
Files 9335 9330 -5
Lines 402949 400659 -2290
Branches 25689 25689
===========================================
- Hits 324921 322621 -2300
- Misses 77562 77572 +10
Partials 466 466 |
19a6a8e to
99b8543
Compare
99b8543 to
1569e30
Compare
cvxluo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
not blocking: i'm not completely sold on option version being needed. i understand that it likely will make the data collection easier to stop using our old cached values when we change the possible expiry times, but it seems like a complicated solution — i'm not sure why we couldn't just have a single option "expiry_time" and experimentally tweak that up and down to find a good balance between hit rate and cache storage
|
You’re not entirely wrong about the complication. I could have just had an option for version and manually incremented it any time the trial values were changed, too, which would have been simpler. This was a (maybe weird) way of me being a little lazy, LOL. Since this is all temporary anyway, I ended up prioritizing ease of testing/comparison over maintainability, which I probably wouldn't have done otherwise. |
Currently, we only tag our
grouping.get_or_create_grouphashes.check_secondary_hash_existenceandgrouping.get_or_create_grouphashes.get_or_create_grouphashmetrics with the cache expiry time in cases where there's a cache hit. When there was only one possible expiry time, that worked fine, because anything that was a cache miss also can be assumed to have used that same expiry period. However, now that we're testing multiple expiry times at once, it's impossible to know which expiry time led to a given miss, which in turn throws off our hit-rate calculations.To fix that problem, this PR adds the
expiry_secondstag to misses as well. Since by definition misses don't find anything in the cache, this also switches from using a cached expiry value to using the current expiry value. Finally, so that using the current value doesn't pollute results based on hits stored with an old value, it also introduces the use of cache versioning. That way, any time the list of potential cache times changes, no previously-stored values will be found.