-
Notifications
You must be signed in to change notification settings - Fork 296
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
view: only commit to database on nonempty blocks
The initial version of the view service's sync logic suffered from poor sync performance as the size of the NCT grows, because it commits the full NCT to the database on every block. This causes a massive amount of disk traffic. In the future, we'll avoid this by using incremental serialization of the NCT, so that the data to serialize drops from being on the order of megabytes to on the order of kilobytes. In the meantime, this is an easy optimization for empty blocks: only commit changes to the database when the block is nonempty. Otherwise, if the block was empty, there was no data to update, except the NCT, which is already in-memory. To actually implement this, we have to be a bit more careful, and also add an in-memory cache for the `last_sync_height` field, update it when we "uncommit" an empty block, and reset it when we commit a nonempty block. Testing locally (without carefully measuring) seems to give a 4-5x speedup on sync times.
- Loading branch information
1 parent
11cc77b
commit ab98ccf
Showing
5 changed files
with
75 additions
and
12 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
This file contains 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