Skip to content

Increase compute_shuffled_index cache from 96 to 65536 entries#5046

Merged
jtraglia merged 1 commit intoethereum:masterfrom
jtraglia:increase-compute-shuffled-index-lru-size
Mar 26, 2026
Merged

Increase compute_shuffled_index cache from 96 to 65536 entries#5046
jtraglia merged 1 commit intoethereum:masterfrom
jtraglia:increase-compute-shuffled-index-lru-size

Conversation

@jtraglia
Copy link
Copy Markdown
Member

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.

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 jtraglia merged commit ca2efda into ethereum:master Mar 26, 2026
16 checks passed
@jtraglia jtraglia deleted the increase-compute-shuffled-index-lru-size branch March 26, 2026 19:02
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant