feat(sync/pending): take complete_previous_block off the critical path#3500
Closed
CHr15F0x wants to merge 5 commits into
Closed
feat(sync/pending): take complete_previous_block off the critical path#3500CHr15F0x wants to merge 5 commits into
CHr15F0x wants to merge 5 commits into
Conversation
6b23181 to
b5d7dc6
Compare
b5d7dc6 to
ff9948a
Compare
Contributor
Author
|
This optimization is not worth the cost, which is introducing race condition in subscriptions for the sake of gaining 1RT of preconfirmed latency (given it chains properly). |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR is based on the 1st pending data optimization PR, and is a preparation for a follow-up PR which will address the issue of chaining within a gap larger than 2 blocks from the latest preconfirmed to the latest block locally committed to storage, which is the major culprit in preconfirmed latency as we experience it today.
The PR takes advantage of the fact that
complete_previous_blockcan be taken off the critical path and hence the cache can be updated faster with the latest preconfirmed, while any remaining tail transactions to the previous block will still be served for the subscriptions, without re-invalidating the latest RPC read view.For this reason two consumers of the cache were introduced:
complete_previous_blockyielded any.Other changes in the PR:
The
next_block_number != committed_head + 1instore_pre_confirmedis relaxed, because it relies on thecurrentwatch which can briefly lag behind the DB. When it lags by one, a perfectly good pre-confirmed view fails the exact check and is dropped. Exact chaining remains the RPC read path's responsibility. Earlier, this was somewhat redundant on the sync and RPC side of things.try_from_pre_confirmed_blockandtry_from_pre_confirmed_and_pre_latestare now called from withinblock_in_placeto make sure that other task are making progress in a multithreaded runtime (these calls are otherwise inlined in tests).