-
Notifications
You must be signed in to change notification settings - Fork 235
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
refactor(perf): replace sync struct HeaderView with HeaderIndexView #3970
Conversation
@@ -101,7 +101,7 @@ bootnode_mode = false | |||
support_protocols = ["Ping", "Discovery", "Identify", "Feeler", "DisconnectMessage", "Sync", "Relay", "Time", "Alert", "LightClient", "Filter"] | |||
|
|||
# [network.sync.header_map] | |||
# memory_limit = "600MB" | |||
# memory_limit = "256MB" |
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.
Changed the default memory limit to smaller one, it can keep about the same amount of header data in memory as before.
Some(status.contains(BlockStatus::BLOCK_STORED)), | ||
)? | ||
.into_inner(); | ||
.get_header_index_view(&parent_hash, 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.
we have checked the status if contains BLOCK_STORED
in line 148 and returned early, no need to check it again here.
e29af19
to
0c8e91e
Compare
0c8e91e
to
62e3454
Compare
What problem does this PR solve?
resolve #3940
What is changed and how it works?
replace the struct
HeaderView
of sync mod with a more memory compact structHeaderIndexView
, and avoid holding headers messages in memory (remove bytes slice clone).Compare with v0.109.0, this PR reduced the peak memory usage from 3.8G to 2.8G during IBD sync on my local PC. @jiangxianliang007 also did test on an aws c5.xlarge instance (4C8G), it reduced from 3.2G to 2.3G, sync performance has also improved, from 0 to 9 million, dropping from 19 hours and 25 minutes to 17 hours and 30 minutes.
please not that this PR didn't replace the HeaderMap storage sled with other solution, there is another PR in testing
Check List
Tests
Release note