Actively manage local archive-index cache#3249
Merged
syphar merged 1 commit intorust-lang:mainfrom Mar 15, 2026
Merged
Conversation
GuillaumeGomez
approved these changes
Mar 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR tries to solve a couple of issues with the local index cache that I had on my mind generally, and will become a real issue when the (ideal) new infra setup.
The issue is:
And with fargate / ECS we have to think about:
there are also other options in hosting where the issue might not that extreme, but I would like to have control over it, and be able to safely just recycle machines.
So what I wanted is:
The initial approaches I had were quite complex, using
atimeand other things, which became quite complex.Then I had the idea about this approach:
mokacrate already provides all the necessary algorithms (even TinyLFU, which is even better)try_get_with_by_refcan serialize our index-download, which makes our previousDashMap<Mutex>obsolete.The only caveats to this approach I can see each time we restart the server:
But IMO nether a big issue.
Some other notable addition are metrics: with these we'll be able to see
The entry sizes might be important when we aim for smaller cache sizes (let's imagine 1 GiB). We might have index databases that are bigger (100s of MiB), and one added big database might invalidate many smaller databases. The possible solution to that is keeping a separate manager for these entries. But there, we would need to know how often that happens, and which sizes, which means we need these metrics.
I also added a benchmark to see if the performance compares, and it does:
Benchmark comparision with `main`