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

Improve unified scheduler pipelining by chunking #2882

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ryoqun
Copy link
Collaborator

@ryoqun ryoqun commented Sep 10, 2024

Problem

Unlike blockstore-processor, unified scheduler can start processing transaction async as soon as it is fed with transactions. However, entries are currently fed in one large sweep when both catching-after-full-repair and normal replaying stage (the notorious 100ms):

let timer = Duration::from_millis(100);

Summary of Changes

Introduce chunked entry load api in Blockstore and use it only for unified scheduler. Hence, subsequent deshredding can overlap in time with already-submitted unified scheduler processing, improving pipeline efficiency.

Lastly, note that this is optimization only applicable to block verification. block production by unified scheduler won't benefit at all. (however, some measurable gain for block verification, hence a this pr)

before

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

after

maybe 4-5% gain

ledger processed in 13 seconds, 209 ms
ledger processed in 13 seconds, 276 ms
ledger processed in 13 seconds, 207 ms

Extracted from: #2325

@@ -3501,6 +3501,66 @@ impl Blockstore {
Ok((entries, num_shreds, slot_meta.is_full()))
}

pub fn get_chunked_slot_entries_in_block(
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

write tests?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

best viewed in hide-whitespace mode diff. :)

ledger/src/blockstore.rs Outdated Show resolved Hide resolved
ledger/src/blockstore.rs Outdated Show resolved Hide resolved
let keys = (start..=end).map(|index| (slot, u64::from(index)));
let range_shreds = self
.data_shred_cf
.multi_get_bytes(keys)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i wonder how much overhead it incurs here instead of one-giant invocation of .multi_get_bytes().

@ryoqun ryoqun force-pushed the chunked-entries branch 8 times, most recently from c631208 to 6469bc9 Compare September 11, 2024 13:27
@ryoqun
Copy link
Collaborator Author

ryoqun commented Sep 11, 2024

After #2881, the bench crossed the 13-sec wall:

ledger processed in 12 seconds, 920 ms
ledger processed in 12 seconds, 935 ms
ledger processed in 13 seconds, 77 ms

for reference here's recent blockstore-processor numbers:

ledger processed in 27 seconds, 124 ms
ledger processed in 26 seconds, 902 ms
ledger processed in 26 seconds, 997 ms

@ryoqun
Copy link
Collaborator Author

ryoqun commented Nov 24, 2024

note to self: this pr is kind of stale.. currently it's known this chunked behavior adversely affects entry verification rayon thread group.

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.

1 participant