-
Notifications
You must be signed in to change notification settings - Fork 11.1k
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
[refactor] introduce an LRU cache inside certificate store #9760
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ |
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.
In some other uses of LRU we had a wrapper over the lru dependency. Shall we reuse that logic here as a template? ie check this PR
#9056
*maybe @mystenmark and @benr-ml who did that before can provide more intel on this (ie we use this for metrics etc)
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.
a04e868
to
3d56062
Compare
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.
Nice addition Tasos! 🚀
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.
I think adding a data structures that keeps certificates above GC round consistently should not be much more complex. If we add that in future, do you think we still need the cache?
@mwtian let's talk more about what you have in mind because for sure I can see other alternatives than this cache. I would still prefer adding this for the time being so we get some gains and we can always remove it later as it's not too invasive. What do you think? |
…port for cache metrics.
…es. Increase cache size
…n seems good enough
5792ef1
to
a88c159
Compare
Description
This PR is introducing an LRU cache in the certificate_store in order to minimise the impact from the read operations (only on the primary index at the moment). That will help:
relevant metrics for cache hit/miss have been added.
The cache has been set to hold 100 * 60 items (100 nodes X 60 rounds) - but we can tune further. Also, we only populate the cache when we write a certificate - especially for the cases we are interested I don't consider we need to re-populate on read.
Test Plan
Added unit tests
If your changes are not user-facing and not a breaking change, you can skip the following section. Otherwise, please indicate what changed, and then add to the Release Notes section as highlighted during the release process.
Type of Change (Check all that apply)
Release notes