Skip to content
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

v2.0: increase writeable accounts cost hashmap size (backport of #3009) #3019

Merged
merged 1 commit into from
Oct 1, 2024

Conversation

mergify[bot]
Copy link

@mergify mergify bot commented Sep 28, 2024

Problem

During block packing, we maintain a hashmap that tracks the CUs for each writeable account. We constrain this to 12M CUs for a given account because we know accessing the same account restricts parallelism, and serializing too many operations may inflate slot times beyond 400ms.

We currently pre-allocate this hashmap with a capacity of 512. Not sure where exactly this number came from, but looks like it was chosen ~3 years ago.

Looking at mainnet over the last 7 days, we can see that we touch an average of 2.5-3k accounts and a max of ~5k (w/ spikes beyond 8k):
image

As soon as we go beyond the 512 pre-allocation, we have to resize the hashmap, which is costly.

Summary of Changes

Increase the default allocation to 4k so that we don't have to resize most of the time. Even at this size, the hashmap should be only 128kB or so. It might make sense to go even larger so we almost never have to resize (maybe 6k or 8k)


This is an automatic backport of pull request #3009 done by Mergify.

@mergify mergify bot requested a review from a team as a code owner September 28, 2024 14:43
@bw-solana
Copy link

@t-nelson or @sakridge - Need your backport review of this 1 liner

@bw-solana bw-solana merged commit 6523316 into v2.0 Oct 1, 2024
38 checks passed
@bw-solana bw-solana deleted the mergify/bp/v2.0/pr-3009 branch October 1, 2024 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants