Defer hash checking and rehashing off-thread #1190
Open
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.
Right now, a significant amount of work in the Crucible Downstairs is simply hashing data:
on_disk_hash
#1161)Together, this take up about 17% of our flamegraph, and are both in the
do_work
task (dw_task
):This PR moves that hash checking off-thread into the
rayon
thread pool, which is common for this kind of blocking work:The strategy is very similar to #1066 and #1089 , and uses the same
DeferredQueue
data structure (moved tocrucible_common
):resp_loop
with all of their write metadata (e.g. hashes) precomputed. We then use those hashes inregion_write_pre
, instead of computing them inRegion::region_write
andExtentInner::write
This is a roughly 10% speedup for large writes:
Previously, I was seeing numbers in the 700-ish range, e.g.