Increase compute_shuffled_index cache from 96 to 65536 entries#5046
Merged
jtraglia merged 1 commit intoethereum:masterfrom Mar 26, 2026
Merged
Conversation
The existing LRU cache for `compute_shuffled_index` was sized at `SLOTS_PER_EPOCH * 3` (96 entries), which is smaller than the default mainnet test validator set (256 validators). This caused cache thrashing on mainnet preset tests. Increasing to `2**16` (65536) entries allows the cache to hold the full shuffle permutation for the test validator set, resulting in a 51% speedup for some Gloas tests. Memory overhead scales with actual usage, not cache capacity, so the larger size has should come at little cost for small validator sets.
jtraglia
added a commit
that referenced
this pull request
Mar 27, 2026
In #5046, we increased the cache size from 96 to 65,536. I believe this was too much as our runners are "losing contact" (aka crashing) around 8 hours into the mainnet-gloas tests. I suspect they are running out of memory; that's the common reason. In my testing, 1024 will improve performance in most situations except the large validator set tests.
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.
The existing LRU cache for
compute_shuffled_indexwas sized atSLOTS_PER_EPOCH * 3(96 entries), which is smaller than the default mainnet test validator set (256 validators). This caused cache thrashing on mainnet preset tests.Increasing to
2**16(65536) entries allows the cache to hold the full shuffle permutation for the test validator set, resulting in a 51% speedup for some Gloas tests. Memory overhead scales with actual usage, not cache capacity, so the larger size has should come at little cost for small validator sets.