Skip to content

Box NewTaskPayload to reduce size greatly#2881

Merged
ryoqun merged 1 commit into
anza-xyz:masterfrom
ryoqun:boxed-new-task-payload
Sep 10, 2024
Merged

Box NewTaskPayload to reduce size greatly#2881
ryoqun merged 1 commit into
anza-xyz:masterfrom
ryoqun:boxed-new-task-payload

Conversation

@ryoqun
Copy link
Copy Markdown
Member

@ryoqun ryoqun commented Sep 10, 2024

Problem

NewTaskPayload is large (more than 200 bytes) due to its direct inclusion of ExecuteTimings. In turn, this causes large mem writes/reads around crossbeam channel even for NewTaskPayload::Task.

Note that this is particularly problematic for block production mode (senders are multi-threaded whereas block verification is currently single-threaded) because those writes are inside crossbeam channel's linearization point, creating a source of contention.

Summary of Changes

Box the rare variant, which only occurs once per bank, benefiting the other variant channel transmission (99.9% of time). Overall, extra indirection for access and mem alloc/dealloc for the NewTaskPayload::OpenSubchannel variant pays off.

before

ledger processed in 13 seconds, 977 ms
ledger processed in 13 seconds, 777 ms
ledger processed in 13 seconds, 905 ms

after

maybe 1-2% gain.

ledger processed in 13 seconds, 678 ms
ledger processed in 13 seconds, 512 ms
ledger processed in 13 seconds, 856 ms

Extracted from: #2325

@ryoqun ryoqun force-pushed the boxed-new-task-payload branch from 40875a7 to 20a13ab Compare September 10, 2024 04:02
@ryoqun ryoqun requested a review from apfitzge September 10, 2024 04:21
@ryoqun ryoqun merged commit 6bd5d38 into anza-xyz:master Sep 10, 2024
ray-kast pushed a commit to abklabs/agave that referenced this pull request Nov 27, 2024
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.

2 participants