-
Notifications
You must be signed in to change notification settings - Fork 92
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
Optimize memory use for blockindex #682
Optimize memory use for blockindex #682
Conversation
Took a while to read the Diff, but changes seem to make sense, will do a build and some tests on mainnet.
|
Btw @aguycalled I saw some lines modified that only changed the whitespace, might make sense to add a linter of some sort to enforce some rules on whitespace, indentation and formatting. |
A new build of 67a7a79 has completed succesfully! |
A new build of f4177a6 has completed succesfully! |
Old master build was running 1.75GB RAM on my navcoind node, this branch is using about 1.5GB |
Ran the stress script 2 times for ~400 blocks each time, worked fine with this branch. |
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.
Ubuntu 18.04 local build qt wallet reduced from 2.6 GB memory to 2.4 GB
Windows 10 Gitian build qt wallet reduced from 2.5 GB to 1.96 GB
Tested Syncing mainnet with all index with no problem
This pull request optimizes the memory storage of the block indexes.
Block indexes store for every block the block header and some information needed for the chain validation. They are permanently kept in memory to speed up the validation process. Part of this extra data are the votes of the community fund/dao. Even if the votes of a block were empty, they were still using some memory space. This means even the first blocks of the chain (when no community fund was active) were taking memory space as if they had votes. This effect has been exaggerated with the introduction of the dao upgrade.
After the patch, a different set of data structures are used. Only blocks which include votes of a particular type attach data to those structures, hence reducing considerably the memory use. Other unused fields like prevoutStake and nStakeTime are also removed from memory.
What to test: