Repository navigation
Fire default-workload GET miss-rate warning for --run-count AVERAGE - #586
Merged
Merged
Conversation
The default-workload branch of the miss-rate warning in print() reads m_totals.m_hits / m_misses. For a single run those are live counters, but aggregate_average() builds the AVERAGE totals from summarize() + totals::add(), and summarize() never fills m_hits / m_misses. The AVERAGE section therefore saw 0 / 0 and never warned, even at 100% misses, while BEST and WORST did. Carry each run's GET hit/miss counts into the AVERAGE totals right after summarize(), the same way the per-run latency histogram is merged explicitly. They are summed across runs, matching how m_arbitrary_misses is handled for the --command path. Fixes #585 Co-Authored-By: Claude Opus 5.5 <[email protected]>
The all-miss workload could not tell hits from misses, so dropping the hit carry-over or adding hits to misses in aggregate_average() still passed. Add a partial-hit case (3 of 10 keys preloaded): the AVERAGE warning must report exactly the server's summed keyspace hits/misses across both runs, and a threshold above the real miss rate must keep every section silent, AVERAGE included. Identify the AVERAGE warning by its summed ops count (and print order) instead of relying on BEST/WORST covering one run each. The default workload takes the same path in cluster mode, so the tests run on oss-cluster too. Move them to their own numbered section and list them in the module docstring. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
Problem
With
--run-count> 1 and the default SET/GET workload, the GET miss-rate warning never fires for the AGGREGATED AVERAGE RESULTS section. On an empty DB,-t 1 -c 2 -n 2000 --ratio 0:1 --run-count 2prints 3 results sections but only 2 warnings (BEST and WORST).Root cause
The default-workload branch of the warning in
run_stats::print()readsm_totals.m_hits/m_totals.m_misses. For a single run these are live counters.aggregate_average()builds the AVERAGE totals fromsummarize()+totals::add(), andsummarize()never fillsm_hits/m_misses, so the AVERAGE object always has 0 / 0.print()skipssummarize()for it, so nothing fills them later, and the warning is skipped becausetotal == 0.Fix
In
aggregate_average(), right aftersummarize()+add(), add each run'sm_totals.m_hits/m_missesto the AVERAGE totals. This mirrors how the per-run latency histogram is already merged explicitly there. The counts are summed across runs, matching howm_arbitrary_missesis handled for the--commandpath, so the AVERAGE warning reads e.g.(8000 misses / 8000 ops)for 2 × 4000.Only the warning reads these two fields on the AVERAGE object. JSON and the text table use
m_hits_sec/m_misses_sec, which are unchanged.Test evidence
Two tests in
test_miss_rate_tracking.py(section 11). Both run on standalone and oss-cluster.test_run_count_average_default_get_miss_warning: empty DB,--ratio=0:1 --run-count=2. Asserts one GET warning per results section. The AVERAGE warning, identified by its summed ops count and print order, must read100%, 1200 / 1200.test_run_count_average_default_get_partial_miss_rate: 3 of 10 keys preloaded (~70% misses). The AVERAGE warning must equal the server's summedkeyspace_hits/keyspace_missesacross both runs (e.g. 848 / 1200). With--miss-rate-threshold=95, no section may warn.100%, 848 / 848; warns at threshold 95)1200 / 1200vs848 / 1200)Manual repro, before / after:
Fixes #585
Affected versions
2.4.0 through 2.5.2 (latest) and master. Introduced by 1485147 (#398), first tag 2.4.0. Confirmed by running on 2.4.0, 2.5.2 and master e4d14e8; 2.1.0 has no such warning. 2.4.1–2.4.4 and 2.5.0–2.5.1 are derived from history.
🤖 Generated with Claude Code
Note
Low Risk
Narrow change to multi-run aggregation for warning-only hit/miss counters; covered by new integration tests.
Overview
Fixes GET miss-rate warnings for the AGGREGATED AVERAGE section when
--run-count> 1 on the default SET/GET workload. BEST/WORST already warned; AVERAGE skipped becauseaggregate_average()never populatedm_totals.m_hits/m_missesaftersummarize()(unlike latency histograms and arbitrary-command miss totals).run_stats::aggregate_average()now sums each run’sm_totals.m_hitsandm_missesinto the averaged totals soprint()’s default-workload--miss-rate-thresholdcheck sees non-zero ops (e.g. summed misses across runs). JSON/text Hits/sec / Misses/sec are unchanged.Integration tests in
test_miss_rate_tracking.pyassert one warning per results section (BEST/WORST/AVERAGE), correct summed counts on AVERAGE for all-miss and partial-hit runs, and no warning when threshold is above the real miss rate.Reviewed by Cursor Bugbot for commit c307679. Bugbot is set up for automated code reviews on this repo. Configure here.