A version check answers a current caller without walking the cluster - #511
Open
bjmeetsfo wants to merge 2 commits into
Open
A version check answers a current caller without walking the cluster#511bjmeetsfo wants to merge 2 commits into
bjmeetsfo wants to merge 2 commits into
Conversation
Asking whether the topology has moved is how a caller avoids fetching it:
send the version you hold, and the metaserver says whether there is anything
newer. The answer that cost the most to produce was the one that says no --
and that is the answer almost every check gets, because callers ask far more
often than the topology changes.
Two things made it expensive.
It collected every table and every recorded event newer than the caller's
version, before deciding there were none. Nothing can be newer than a caller
who is already current: a table is stamped with the version
record_topology_event returns, which is the global version as it stood when
it was bumped, so no table and no event can carry one above it.
It also counts how many servers, proxies and tables are normal, frozen and
dropped -- and walked each collection once per state. Nine walks of three
collections to answer one check. The states are disjoint, so one walk tallies
all three.
tables before after
500 6.0 us 1.9 us
2 000 25.1 us 8.7 us
8 000 145.8 us 47.3 us
Three times faster, measured before and after back to back.
None of those nine numbers had a test. Counting a frozen server as a normal
one passed the whole suite, which is a poor position from which to rewrite
how all nine are computed, so there is a test now: one resource of each kind
in each state, and every count checked.
# Conflicts: # crates/temporalstore-rust/src/meta.rs
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.
Asking whether the topology has moved is how a caller avoids fetching it:
send the version you hold, and the metaserver says whether there is anything
newer. The answer that cost the most to produce was the one that says no --
and that is the answer almost every check gets, because callers ask far more
often than the topology changes.
Two things made it expensive.
It collected every table and every recorded event newer than the caller's
version, before deciding there were none. Nothing can be newer than a caller
who is already current: a table is stamped with the version
record_topology_event returns, which is the global version as it stood when
it was bumped, so no table and no event can carry one above it.
It also counts how many servers, proxies and tables are normal, frozen and
dropped -- and walked each collection once per state. Nine walks of three
collections to answer one check. The states are disjoint, so one walk tallies
all three.
Three times faster, measured before and after back to back.
None of those nine numbers had a test. Counting a frozen server as a normal
one passed the whole suite, which is a poor position from which to rewrite
how all nine are computed, so there is a test now: one resource of each kind
in each state, and every count checked.