Conversation
Codecov Report
@@ Coverage Diff @@
## master #177 +/- ##
==========================================
+ Coverage 48.62% 48.86% +0.23%
==========================================
Files 39 39
Lines 6577 6586 +9
==========================================
+ Hits 3198 3218 +20
+ Misses 3033 3028 -5
+ Partials 346 340 -6
Continue to review full report at Codecov.
|
a-urth
reviewed
Aug 21, 2019
78b706f to
bf945f8
Compare
36a450d to
cab020b
Compare
Contributor
Author
|
From a single run:
|
a-urth
approved these changes
Sep 13, 2019
6737a3b to
263026f
Compare
Contributor
Author
|
Badger DB implementation is removed from this PR. Merge #217 instead to get Badger db. |
cca641d to
fb41996
Compare
939d110 to
95543bb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Syncing rounds currently requires the node to hold the entire diff in memory (both for sending and receiving). If the diff happens to be really big, it can easily overwhelm the node and taking it down. The objective of this PR to bound the memory usage of ledger during state syncing by writing to disk when necessary, while at the same time not sacrificing too much performance.
Major changes:
State diff dump is now preceeded with
<no. of diffs: 8 bytes><diff id: 16 bytes>.... This is done to allow the receiver to get the diff ids first without having to deserialize all the nodes.Diff is dumped into a buffer that is bounded in memory, but unbounded on disk.
Once the diff is chunked, it's stored in a hash map which spills to on-disk KV if it exceeds the cache size.
Downloaded chunks are written to a buffer that is bounded in memory, but unbounded on disk.
Once all chunks are downloaded, it is deserialized into diff nodes one by one by
populateDiffsinstead of having to preload all the nodes first.