No longer serialize small indexes to disk #4270
Merged
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.
Description
Resolves #4268
Previously, we serialized every BucketListDB index to disk, regardless of size. This created significant disk churn in small, top level buckets, where new indexes are being re-written constantly.
This change no longer serializes the
IndividualIndex
type to disk to reduce this churn. By default, all buckets with size < 20 MB have individual indexes, so this will remove disk churn on the small, top most buckets. This also removes writing indexes to disk on the main thread, as previouslyBucket::addBatch
needed to write indexes to disk as part ofledgerClose
.There are essentially no drawbacks to recreating individual indexes on startup. They are so small that recreating them takes about as long as deserializing them. This change adds approximately 100ms to node startup time.
Checklist
clang-format
v8.0.0 (viamake format
or the Visual Studio extension)