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

caches reed-solomon encoder/decoder instance #27510

Merged
merged 1 commit into from
Sep 25, 2022

Conversation

behzadnouri
Copy link
Contributor

@behzadnouri behzadnouri commented Aug 31, 2022

Problem

ReedSolomon::new(...) initializes a matrix and a data-decode-matrix cache:
https://github.com/rust-rse/reed-solomon-erasure/blob/273ebbced/src/core.rs#L460-L466

Current master code is redoing this computation for each batch.

Summary of Changes

In order to cache this computation, this commit caches the reed-solomon
encoder/decoder instance for each (data_shards, parity_shards) pair.

@behzadnouri
Copy link
Contributor Author

broadcast-process-shreds-stats::gen_coding_time: Right chunk is this code vs current master code on the left:

gen_coding_time

sakridge
sakridge previously approved these changes Aug 31, 2022
Copy link
Member

@sakridge sakridge left a comment

Choose a reason for hiding this comment

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

nice speedup, lgtm

steviez
steviez previously approved these changes Sep 1, 2022
@@ -346,6 +369,38 @@ impl Shredder {
}
}

impl ReedSolomonCache {
const CAPACITY: usize = 4 * DATA_SHREDS_PER_FEC_BLOCK;
Copy link
Contributor

@carllin carllin Sep 2, 2022

Choose a reason for hiding this comment

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

nit: A comment on why this should be a function of DATA_SHREDS_PER_FEC_BLOCK would be helpful

@behzadnouri
Copy link
Contributor Author

Waiting on upstream reed-solomon-erasure crate merge rust-rse/reed-solomon-erasure#104 first.

behzadnouri added a commit to behzadnouri/solana that referenced this pull request Sep 23, 2022
behzadnouri added a commit to behzadnouri/solana that referenced this pull request Sep 23, 2022
@mergify mergify bot dismissed stale reviews from sakridge and steviez September 23, 2022 21:01

Pull request has been modified.

behzadnouri added a commit that referenced this pull request Sep 24, 2022
mergify bot pushed a commit that referenced this pull request Sep 24, 2022
Need to pick up:
rust-rse/reed-solomon-erasure#104
in order to unblock:
#27510

(cherry picked from commit f02fe9c)

# Conflicts:
#	ledger/Cargo.toml
ReedSolomon::new(...) initializes a matrix and an inversion-tree:
https://github.com/rust-rse/reed-solomon-erasure/blob/eb1f66f47/src/core.rs#L450-L458

In order to cache this computation, this commit caches the reed-solomon
encoder/decoder instance for each (data_shards, parity_shards) pair.
mergify bot added a commit that referenced this pull request Sep 24, 2022
…#28048)

* updates reed-solomon-erasure crate version to 6.0.0 (#28033)

Need to pick up:
rust-rse/reed-solomon-erasure#104
in order to unblock:
#27510

(cherry picked from commit f02fe9c)

# Conflicts:
#	ledger/Cargo.toml

* removes mergify merge conflicts

Co-authored-by: behzad nouri <behzadnouri@gmail.com>
@behzadnouri
Copy link
Contributor Author

With rust-rse/reed-solomon-erasure#104 merged in, this also shows improvement on the recovery end.
Right chunk is this code vs current master code on the left.
blockstore-insert-shreds::shred_recovery_elapsed_us:
blockstore-insert-shreds shred_recovery_elapsed_us

Also slightly more shreds are recovered (maybe because of faster recovery code):
num_recovered

@behzadnouri behzadnouri merged commit f49beb0 into solana-labs:master Sep 25, 2022
@behzadnouri behzadnouri deleted the reed-solomon-cache branch September 25, 2022 18:09
mergify bot pushed a commit that referenced this pull request Sep 25, 2022
ReedSolomon::new(...) initializes a matrix and a data-decode-matrix cache:
https://github.com/rust-rse/reed-solomon-erasure/blob/273ebbced/src/core.rs#L460-L466

In order to cache this computation, this commit caches the reed-solomon
encoder/decoder instance for each (data_shards, parity_shards) pair.

(cherry picked from commit f49beb0)
mergify bot added a commit that referenced this pull request Sep 26, 2022
caches reed-solomon encoder/decoder instance (#27510)

ReedSolomon::new(...) initializes a matrix and a data-decode-matrix cache:
https://github.com/rust-rse/reed-solomon-erasure/blob/273ebbced/src/core.rs#L460-L466

In order to cache this computation, this commit caches the reed-solomon
encoder/decoder instance for each (data_shards, parity_shards) pair.

(cherry picked from commit f49beb0)

Co-authored-by: behzad nouri <behzadnouri@gmail.com>
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.

None yet

4 participants