Create a specific calculateRootHash method for BonsaiInMemoryWorldState to improve performance#4568
Conversation
|
These files required manual handling in commit da8904d: |
Signed-off-by: garyschulte <garyschulte@gmail.com>
… method Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net>
Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net>
Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net>
Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net>
Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net>
Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net>
Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net>
Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net>
Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net>
da8904d to
e650a67
Compare
|
@ahamlat - I took the liberty of rebasing this off of main. the merges of main and rc3 branch were making the commit history too hard to follow. |
Signed-off-by: garyschulte <garyschulte@gmail.com>
e650a67 to
646482f
Compare
Signed-off-by: garyschulte <garyschulte@gmail.com>
Signed-off-by: garyschulte <garyschulte@gmail.com>
| } finally { | ||
| updater.rollback(); | ||
| final Hash calculatedRootHash = calculateRootHash(localUpdater); | ||
| return Hash.wrap(calculatedRootHash); |
commit 0d24b22 Author: Fabio Di Fabio <fabio.difabio@consensys.net> Date: Wed Nov 2 21:34:35 2022 +0100 Preparing for next release (besu-eth#4595) Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net> commit b50f866 Author: ahamlat <ameziane.hamlat@consensys.net> Date: Wed Nov 2 18:05:15 2022 +0100 Create a specific calculateRootHash method for BonsaiInMemoryWorldState to improve performance (besu-eth#4568) * Parallelize some steps in BonsaiPersistedWorldState.calculateRootHash method Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net> * Add synchronized on storage flat database remove and update method Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net> * Add synchronized on storage flat database remove and update method Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net> * Fix this error org.rocksdb.RocksDBException: unknown WriteBatch tag Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net> * create a specific calculateRootHash for BonsaiInMemoryWorldState class Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net> * create a specific calculateRootHash for BonsaiInMemoryWorldState class Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net> * Fix nullPointerException on Collections.synchronizedSet Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net> * Use parallelStreams instead of CompletableFuture API Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net> * Modify CHANGELOG.md Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net> * spotless and synchronizedSet initializaton Signed-off-by: garyschulte <garyschulte@gmail.com> Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net> Signed-off-by: garyschulte <garyschulte@gmail.com> Co-authored-by: garyschulte <garyschulte@gmail.com> Co-authored-by: Sally MacFarlane <macfarla.github@gmail.com>
…te to improve performance (besu-eth#4568) * Parallelize some steps in BonsaiPersistedWorldState.calculateRootHash method Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net> * Add synchronized on storage flat database remove and update method Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net> * Add synchronized on storage flat database remove and update method Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net> * Fix this error org.rocksdb.RocksDBException: unknown WriteBatch tag Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net> * create a specific calculateRootHash for BonsaiInMemoryWorldState class Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net> * create a specific calculateRootHash for BonsaiInMemoryWorldState class Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net> * Fix nullPointerException on Collections.synchronizedSet Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net> * Use parallelStreams instead of CompletableFuture API Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net> * Modify CHANGELOG.md Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net> * spotless and synchronizedSet initializaton Signed-off-by: garyschulte <garyschulte@gmail.com> Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net> Signed-off-by: garyschulte <garyschulte@gmail.com> Co-authored-by: garyschulte <garyschulte@gmail.com> Co-authored-by: Sally MacFarlane <macfarla.github@gmail.com> Signed-off-by: Sally MacFarlane <macfarla.github@gmail.com>
…te to improve performance (besu-eth#4568) * Parallelize some steps in BonsaiPersistedWorldState.calculateRootHash method Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net> * Add synchronized on storage flat database remove and update method Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net> * Add synchronized on storage flat database remove and update method Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net> * Fix this error org.rocksdb.RocksDBException: unknown WriteBatch tag Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net> * create a specific calculateRootHash for BonsaiInMemoryWorldState class Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net> * create a specific calculateRootHash for BonsaiInMemoryWorldState class Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net> * Fix nullPointerException on Collections.synchronizedSet Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net> * Use parallelStreams instead of CompletableFuture API Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net> * Modify CHANGELOG.md Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net> * spotless and synchronizedSet initializaton Signed-off-by: garyschulte <garyschulte@gmail.com> Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net> Signed-off-by: garyschulte <garyschulte@gmail.com> Co-authored-by: garyschulte <garyschulte@gmail.com> Co-authored-by: Sally MacFarlane <macfarla.github@gmail.com>
PR description
Create a specific calculateRootHash for BonsaiInMemoryWorldState, avoid committing and rollbacking as it is not necessary. This PR parallelize also the accounts update storage in calculateRootHash method.
The yellow line below is the version with the modifications in this PR, the other node is used as a reference node (a baseline) regarding block size and the number of transactions per block.
We have below engine_newPayloadV1 RPC call (Block processing) mean time comparaison between this PR, version 22.7.6 and version 22.7.7
We can notice also that calculateRootHash method is consuming less (real) time on CPU because of the parallelization and the fact we removed commit and rollback method.
Before this PR

After this PR

Fixed Issue(s)
Mitigate #4549
Documentation
doc-change-requiredlabel to this PR ifupdates are required.
Changelog