-
Notifications
You must be signed in to change notification settings - Fork 4.5k
buffers data shreds to make larger erasure coded sets #15849
Conversation
Codecov Report
@@ Coverage Diff @@
## master #15849 +/- ##
========================================
Coverage 79.9% 79.9%
========================================
Files 409 409
Lines 107723 107822 +99
========================================
+ Hits 86142 86245 +103
+ Misses 21581 21577 -4 |
9cb0653
to
6c13c4b
Compare
does this accumulate data shreds until we see 32? |
@aeyakovenko yes, |
ec89a27
to
9e52898
Compare
9e52898
to
a1e0f15
Compare
once this works, we should be able to add a new confirmation status
I think with these assumptions we can bet that all the other nodes will also execute this block and vote before a fork can form and this block will be optimistically confirmed. |
} | ||
None => Vec::default(), | ||
}; | ||
data_shreds_buffer.extend(data_shreds.clone()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice! could we add a simple test entries_to_data_shreds() -> make_coding_shreds()
with a few iterative batches and then check at the end that one big batch was made?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added more test coverage checking the batching behavior.
None => match blockstore.meta(slot).unwrap() { | ||
Some(slot_meta) => { | ||
let shreds_consumed = slot_meta.consumed as u32; | ||
(shreds_consumed, shreds_consumed) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we may actually be able to remove this outdated case, since if the blockstore has metadata for that slot, it should not recreate the slot due to this check https://github.com/solana-labs/solana/blob/master/ledger/src/leader_schedule_cache.rs#L141-L144
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are probably, but I think we better have a separate commit for that so that this one does not change the logic here, just in case there are unknown consequences.
@@ -418,6 +469,8 @@ impl BroadcastRun for StandardBroadcastRun { | |||
blockstore_sender: &Sender<(Arc<Vec<Shred>>, Option<BroadcastShredBatchInfo>)>, | |||
) -> Result<()> { | |||
let receive_results = broadcast_utils::recv_slot_entries(receiver)?; | |||
// TODO: Confirm that last chunk of coding shreds |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A good way to confirm this might be by monitoring the broadcast-transmit-shreds-stats
metric, end_to_end_elapsed
field. It doesn't look like it should be too big of a deal because even with these changes, it looks like at most we will have at most an additional MAX_DATA_SHREDS_PER_FEC_BLOCK
data shreds to generate coding shreds from on the last iteration of process_receive_results
for this slot compared to the code today (assuming it's not an interrupted slot, interrupted slots may take forever because they wait for the next slot, but that's true even today 😃 )
|
||
// Create and send coding shreds | ||
let coding_shreds = shredder | ||
.data_shreds_to_coding_shreds(&data_shreds[0..last_data_shred], &mut process_stats); | ||
let coding_shreds = make_coding_shreds( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, this is a clean way to avoid changing the num_batches
and num_expected_batches
logic above because it always returns a vector, even if that vector is empty.
@behzadnouri whoo, finally knocking this one out! Really clean work 🧠 , just a few nits 😃 |
e5d65e9
to
8d9c7f9
Compare
Broadcast stage batches up to 8 entries: https://github.com/solana-labs/solana/blob/79280b304/core/src/broadcast_stage/broadcast_utils.rs#L26-L29 which will be serialized into some number of shreds and chunked into FEC sets of at most 32 shreds each: https://github.com/solana-labs/solana/blob/79280b304/ledger/src/shred.rs#L576-L597 So depending on the size of entries, FEC sets can be small, which may aggravate loss rate. For example 16 FEC sets of 2:2 data/code shreds each have higher loss rate than one 32:32 set. This commit broadcasts data shreds immediately, but also buffers them until it has a batch of 32 data shreds, at which point 32 coding shreds are generated and broadcasted.
Broadcast stage batches up to 8 entries: https://github.com/solana-labs/solana/blob/79280b304/core/src/broadcast_stage/broadcast_utils.rs#L26-L29 which will be serialized into some number of shreds and chunked into FEC sets of at most 32 shreds each: https://github.com/solana-labs/solana/blob/79280b304/ledger/src/shred.rs#L576-L597 So depending on the size of entries, FEC sets can be small, which may aggravate loss rate. For example 16 FEC sets of 2:2 data/code shreds each have higher loss rate than one 32:32 set. This commit broadcasts data shreds immediately, but also buffers them until it has a batch of 32 data shreds, at which point 32 coding shreds are generated and broadcasted. (cherry picked from commit 4f82b89) # Conflicts: # ledger/src/shred.rs
Broadcast stage batches up to 8 entries: https://github.com/solana-labs/solana/blob/79280b304/core/src/broadcast_stage/broadcast_utils.rs#L26-L29 which will be serialized into some number of shreds and chunked into FEC sets of at most 32 shreds each: https://github.com/solana-labs/solana/blob/79280b304/ledger/src/shred.rs#L576-L597 So depending on the size of entries, FEC sets can be small, which may aggravate loss rate. For example 16 FEC sets of 2:2 data/code shreds each have higher loss rate than one 32:32 set. This commit broadcasts data shreds immediately, but also buffers them until it has a batch of 32 data shreds, at which point 32 coding shreds are generated and broadcasted. (cherry picked from commit 4f82b89) # Conflicts: # ledger/src/shred.rs
…6074) * buffers data shreds to make larger erasure coded sets (#15849) Broadcast stage batches up to 8 entries: https://github.com/solana-labs/solana/blob/79280b304/core/src/broadcast_stage/broadcast_utils.rs#L26-L29 which will be serialized into some number of shreds and chunked into FEC sets of at most 32 shreds each: https://github.com/solana-labs/solana/blob/79280b304/ledger/src/shred.rs#L576-L597 So depending on the size of entries, FEC sets can be small, which may aggravate loss rate. For example 16 FEC sets of 2:2 data/code shreds each have higher loss rate than one 32:32 set. This commit broadcasts data shreds immediately, but also buffers them until it has a batch of 32 data shreds, at which point 32 coding shreds are generated and broadcasted. (cherry picked from commit 4f82b89) # Conflicts: # ledger/src/shred.rs * removes backport merge conflicts Co-authored-by: behzad nouri <behzadnouri@gmail.com>
Broadcast stage batches up to 8 entries: https://github.com/solana-labs/solana/blob/79280b304/core/src/broadcast_stage/broadcast_utils.rs#L26-L29 which will be serialized into some number of shreds and chunked into FEC sets of at most 32 shreds each: https://github.com/solana-labs/solana/blob/79280b304/ledger/src/shred.rs#L576-L597 So depending on the size of entries, FEC sets can be small, which may aggravate loss rate. For example 16 FEC sets of 2:2 data/code shreds each have higher loss rate than one 32:32 set. This commit broadcasts data shreds immediately, but also buffers them until it has a batch of 32 data shreds, at which point 32 coding shreds are generated and broadcasted. (cherry picked from commit 4f82b89)
Broadcast stage batches up to 8 entries: https://github.com/solana-labs/solana/blob/79280b304/core/src/broadcast_stage/broadcast_utils.rs#L26-L29 which will be serialized into some number of shreds and chunked into FEC sets of at most 32 shreds each: https://github.com/solana-labs/solana/blob/79280b304/ledger/src/shred.rs#L576-L597 So depending on the size of entries, FEC sets can be small, which may aggravate loss rate. For example 16 FEC sets of 2:2 data/code shreds each have higher loss rate than one 32:32 set. This commit broadcasts data shreds immediately, but also buffers them until it has a batch of 32 data shreds, at which point 32 coding shreds are generated and broadcasted. (cherry picked from commit 4f82b89) Co-authored-by: behzad nouri <behzadnouri@gmail.com>
Problem
Broadcast stage batches up to 8 entries:
https://github.com/solana-labs/solana/blob/79280b304/core/src/broadcast_stage/broadcast_utils.rs#L26-L29
which will be serialized into some number of shreds and chunked into FEC
sets of at most 32 shreds each:
https://github.com/solana-labs/solana/blob/79280b304/ledger/src/shred.rs#L576-L597
So depending on the size of entries, FEC sets can be small, which may
aggravate loss rate.
For example 16 FEC sets of 2:2 data/code shreds each have higher loss
rate than one 32:32 set.
Summary of Changes
This commit broadcasts data shreds immediately, but also buffers them
until it has a batch of 32 data shreds, at which point 32 coding shreds
are generated and broadcasted.