Skip to content
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

Cache unchecked count #2458

Merged
merged 1 commit into from Jan 3, 2020
Merged

Conversation

wezrule
Copy link
Contributor

@wezrule wezrule commented Jan 2, 2020

During bootstrapping with RocksDB (collecting all unchecked blocks), 27% of the time was spent checking whether a block exists and updating the unchecked count cache in the ledger. This extra IO was necessary because RocksDB cannot give you accurate counts of the number of keys in a table so it was expensive to determine the unchecked count on the fly. However this can just be done at startup as for the most part this number will actually be low and then just maintain an in-memory cache of the unchecked number, like we now do with: block count, cemented count and rep weights.

This improves bootstrapping substantially for the first phase of collecting all unchecked blocks, but processing unchecked -> checked afterwards is still slow (unchecked_get constitutes 50% of the CPU time), this will be addressed separately (if possible).

Some helper classes have been added to combine all the cacheable things we have in the ledger

@wezrule wezrule added performance Performance/resource utilization improvement database Relates to lmdb or rocksdb labels Jan 2, 2020
@wezrule wezrule added this to the V21.0 milestone Jan 2, 2020
@wezrule wezrule self-assigned this Jan 2, 2020
@wezrule wezrule merged commit d13ab81 into nanocurrency:develop Jan 3, 2020
@wezrule wezrule deleted the cache_unchecked_count branch January 3, 2020 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
database Relates to lmdb or rocksdb performance Performance/resource utilization improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants