Repository navigation
Speed up consensus trace replay - #8848
Closed
cjen1-msft wants to merge 5 commits into
Closed
cjen1-msft wants to merge 5 commits into
cjen1-msft wants to merge 5 commits into
Conversation
Restores the replayer changes from 4fb00c2 that were moved out of the base PR. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
To be removed once the numbers are in the PR description. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Reverts 87fd16b; its timings are in the PR description. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
To be removed once the numbers are in the PR description. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Reverts dd15fe6; its timings are in the PR description. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Member
|
We prefer #8849 |
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.
Makes the Lean consensus replayer faster, so the
cft_replayjob added in #8732 costs less CI time: itsValidate e2e consensus tracesstep drops from 76 s to 20 s.Stacked on #8732, which records consensus trace events in every e2e test and replays them against the Lean model. These optimisations, authored by Amaury Chamayou (@achamayou), were split out of that PR so they can be reviewed on their own.
Step timings of the
Replay e2e consensus tracesjob onubuntu-26.04:Ablation
The per-node observation cache and the reuse of parsed
msgobjects account for most of the gain; the node-id index and the empty-send shortcut have no measurable effect.Both tables time the
Validate e2e consensus tracesstep on anubuntu-26.04runner, on the same captures (the 138 replayable captures of CI run 45581973686). The two tables come from different runner machines, the second about 20% faster, so compare seconds within a table, not between them.Cumulative
Each row adds one optimisation to all the rows above it, ending at this PR. The per-row gains depend on this order, which puts each optimisation after the ones it needs and otherwise the largest expected gain first.
msgof identical consecutive events--scheduletests/cft_trace_validation.pyqsortccf.cftlines before JSON parsingHashMapindex (this PR)msgis JSON-parsed; themsgreuse and the tag skip that build on it are separate rows.Wall times within a row range over 0.7 s to 2.0 s across the five rounds, except 6.9 s in the second row and 4.5 s in the fourth, so the gains under about 1 s in the last five rows are not distinguishable from noise.
Leave one out
Each row is this PR with one optimisation removed.
msgof identical consecutive events [3]--scheduletests/cft_trace_validation.pyqsort[4]ccf.cftlines before JSON parsingHashMapindexSome optimisations depend on others, so these rows overlap rather than add up:
msgreuse, the snapshot skip and the tag skip.How the ablation was measured
python3 tests/cft_trace_validation.py <replayer> <captures>for each, as the CI step does. Cumulative: run 45664027844, scripts in dd15fe6. Leave one out: run 45652302139, scripts in 87fd16b.ubuntu-26.04, 4 cores in use (CPU time is about 3.9 times wall time, so the step is CPU bound). Each run used one runner for all its variants.--lenientand--schedulemodes.Safety and compatibility
The replayer is a test oracle, so the risk is a wrong verdict rather than a product change. No verdict difference was found (evidence below), but the following are worth a reviewer's attention:
buildNodeObsCacheinInterpreter.leanre-derives in one fold what the model defines asactiveConfigurations,retirementIndexInLogandNodeState.retirement(Consensus/Model/ClusterConfig.lean). The checker no longer compares traces against those model definitions directly, and nothing proves the two agree.matchFluentdLineinInput.leanis tied to the exact key order and spacing thatjson.dumpsproduces. Lines with a tag other thanccf.cftare skipped without being parsed, so a malformed non-ccf.cftline no longer fails the trace.prepareEvents,readLogandparseLoginInput.leanare no longer called, andreadEventsrepeats one block three times.Differential testing against the unoptimised replayer
The replayer built before and after this change gave identical exit status and output on:
--lenientand--schedulemodes (60 runs).--lenientmodes (280 runs).