-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[R4R] performance improvement in many aspects #257
Conversation
62904a0
to
5bdb7b4
Compare
0a1cc10
to
e750b5d
Compare
|
||
go p.peer.RequestHeadersByNumber(from, count, 0, false) |
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.
why not use gopool here
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.
It is used when clients doing fast sync and snap sync. Not related to performance
p2p/rlpx/rlpx.go
Outdated
"github.com/ethereum/go-ethereum/crypto" | ||
"github.com/ethereum/go-ethereum/crypto/ecies" | ||
"github.com/ethereum/go-ethereum/rlp" | ||
"github.com/golang/snappy" | ||
"golang.org/x/crypto/sha3" | ||
"github.com/oxtoacart/bpool" |
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.
imports
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.
fixed
core/blockchain.go
Outdated
} | ||
if len(accountsSlice) >= preLoadLimit { | ||
objsChan := make(chan []*state.StateObject, runtime.NumCPU()) | ||
for i := 0; i < runtime.NumCPU(); i++ { |
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.
should we make sure that len(accountsSlice)
> runtime.NumCPU()
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.
Add one more condition: len(accountsSlice) > runtime.NumCPU()
Can we get this PR merged? |
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.
_thank you _
Description: This PR refers to the code optimization done by `BSC`, which mainly includes the following parts: 1. Do BlockBody verification concurrently. 2. Do the calculation of intermediate root concurrently. 3. Commit the MPTs concurrently. 4. Preload accounts before processing blocks. 5. Make the snapshot layers configurable. 6. Reuse some objects to reduce GC. 7. Add shared_pool for `stateDB` to improve cache usage. References: - bnb-chain/bsc#257 - bnb-chain/bsc#792 --------- Co-authored-by: j75689 <j75689@gmail.com> Co-authored-by: realowen <131384228+realowen@users.noreply.github.com>
Description This PR refers to the code optimization done by `BSC`, which mainly includes the following parts: 1. Do BlockBody verification concurrently. 2. Do the calculation of intermediate root concurrently. 3. Commit the MPTs concurrently. 4. Preload accounts before processing blocks. 5. Make the snapshot layers configurable. 6. Reuse some objects to reduce GC. 7. Add shared_pool for `stateDB` to improve cache usage. References - bnb-chain/bsc#257 - bnb-chain/bsc#792 --------- Co-authored-by: j75689 <j75689@gmail.com> Co-authored-by: realowen <131384228+realowen@users.noreply.github.com>
Description This PR refers to the code optimization done by `BSC`, which mainly includes the following parts: 1. Do BlockBody verification concurrently. 2. Do the calculation of intermediate root concurrently. 3. Commit the MPTs concurrently. 4. Preload accounts before processing blocks. 5. Make the snapshot layers configurable. 6. Reuse some objects to reduce GC. 7. Add shared_pool for `stateDB` to improve cache usage. References - bnb-chain/bsc#257 - bnb-chain/bsc#792 --------- Co-authored-by: j75689 <j75689@gmail.com>
accountTrieCache and storageTrieCache were introduced in this PR: bnb-chain#257, which is to improve performance. Actually the performance gain is quite limitted, as there is already dirty and clean cache for trie node. And after big merge, these 2 cache can not be used when PBSS is enabled. So remove these code to simplify the logic.
accountTrieCache and storageTrieCache were introduced in this PR: #257, which is to improve performance. Actually the performance gain is quite limited, as there is already dirty and clean cache for trie node. And after big merge, these 2 cache can not be used when PBSS is enabled. So remove these code to simplify the logic.
accountTrieCache and storageTrieCache were introduced in this PR: bnb-chain#257, which is to improve performance. Actually the performance gain is quite limited, as there is already dirty and clean cache for trie node. And after big merge, these 2 cache can not be used when PBSS is enabled. So remove these code to simplify the logic.
This is part of the optimizations from BSC, microbench show the change could introduce speed up of simple erc20 transfer scenario. The original PR of BSC: bnb-chain/bsc#257
This is part of the optimizations from BSC, microbench show the change could introduce ~20% speed up of simple erc20 transfer scenario. The original PR of BSC: bnb-chain/bsc#257
Description
This PR tries to improve the performance of BSC.
Rationale
Part of Block Processing can be parallel, and the layer of the snapshot is too deeper for the current implementation. This PR focus on:
Example
The testing result on an 8 core 2.5G Hz Linux VM:
Changes
New command flags:
--triesInMemory
Preflight checks
make build
)make test
)Already reviewed by
...
Related issues
... reference related issue #'s here ...