-
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
asynchronous update snap in updatetrie #924
Conversation
dfd67aa
to
3563a29
Compare
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.
LGTM
core/state/state_object.go
Outdated
for key, value := range dirtyStorage { | ||
// If state snapshotting is active, cache the data til commit | ||
if s.db.snap != nil { | ||
s.db.snapMux.Lock() |
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.
as mentioned above, could be better to hold Lock
out of the for
loop
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.
updated
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.
whole for loop including storage update
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.
As noticed in previous comments
0d00ec3
to
27f1bfe
Compare
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.
LGTM
The base branch was changed.
237feb7
to
15e4f1f
Compare
15e4f1f
to
fea1c96
Compare
Description
the updateTrie function need to update trie node and snap in a for loop, since the snap updating need wait lock , it may make update trie slower , this PR use a groutine to update snap to make update trie more efficient
Rationale
When chasing blocks in batches, the time overhead of volidation is reduced by 10%,
The overall efficiency of batch sync blocks has been improved, the follow lines represents the delay of volidation with pipeline commit
When executing the latest block, the latency of updateTrie is reduced by 30%-40%, the follow lines represents the delay of an updateTrie function call.
Example
add an example CLI or API response...
Changes
Notable changes: