Report db_bench interval latency percentiles - #15095
Open
xingbowang wants to merge 1 commit into
Open
Conversation
|
@xingbowang has exported this pull request. If you are a Meta employee, you can view the originating Diff in D115867590. |
✅ clang-tidy: No findings on changed linesCompleted in 148.0s. |
Summary: `db_bench` already prints interval throughput when `--stats_interval_seconds` is set, but latency percentiles were only available in the final aggregate histogram. That made it impossible for the regression harness to report true interval P99/P99.9 latency, because the runner could only parse the final histogram. This diff adds opt-in per-interval latency percentile reporting behind `--report_interval_percentiles`. When enabled together with `--histogram=1` and `--stats_interval_seconds > 0`, db_bench records per-thread, per-operation histograms for the current interval from the existing `Stats::FinishedOps` path. At each stats interval boundary, thread 0 merges the worker histograms, prints one `IntervalPercentiles:` line per operation type with count, P50, P75, P99, P99.9, and P99.99, and clears the interval histograms for the next interval. The new reporting path is off by default and does not change existing final histogram output. It uses per-thread histogram containers guarded by per-thread locks so workers do not contend on one shared histogram while recording operation latency. The dependent benchmark harness diff consumes the new `IntervalPercentiles:` lines to publish interval latency rows to Scuba. Differential Revision: D115867590
xingbowang
force-pushed
the
export-D115867590
branch
from
August 13, 2026 14:07
5ecdde1 to
803c5bf
Compare
✅ Claude Code ReviewAuto-triggered after CI passed — reviewing commit 803c5bf SummaryClean, well-scoped addition of opt-in per-interval latency percentile reporting to High-severity findings (0): Full review (click to expand)Findings🔴 HIGHNone. 🟡 MEDIUMM1.
|
| Context | Applicable? | Assessment |
|---|---|---|
| Thread ID validity | YES | Thread IDs are 0..n-1 from ThreadState(i, ...). The Add() bounds check handles invalid IDs gracefully (silent return). |
| BGWriter/special threads | YES | BGWriter threads call FinishedOps and have interval_stats_reporter_ set by RunBenchmark. Their thread IDs are within 0..n-1, so they correctly contribute to interval stats. |
| Lifetime safety | YES | interval_stats_reporter is owned by unique_ptr in RunBenchmark. All threads are joined before RunBenchmark returns (via shared.num_done < n wait). Safe. |
| HistogramImpl thread safety | YES | Add() is lock-free (relaxed atomics). Merge() and Clear() acquire internal mutex. External per-thread mutex provides ordering between worker Add and thread-0 Merge+Clear. Safe. |
| Benchmarks not using RunBenchmark | YES | interval_stats_reporter_ defaults to nullptr. The nullptr check guards this. Safe. |
Positive Observations
- Cleanly opt-in with sensible flag prerequisites (
--histogram --stats_interval_seconds). - Per-thread histogram design correctly avoids cross-thread contention.
- Defensive
thread_idbounds check inAdd(). - Good drive-by fix of
reporter_agent_initialization. - Structured, machine-parseable output format with labeled key=value pairs.
- Does not affect existing final histogram output.
ℹ️ About this response
Generated by Claude Code.
Review methodology: claude_md/ci_review_prompt.md
Limitations:
- Claude may miss context from files not in the diff
- Large PRs may be truncated
- Always apply human judgment to AI suggestions
Commands:
/claude-review [context]— Request a code review/claude-query <question>— Ask about the PR or codebase
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.
Summary:
db_benchalready prints interval throughput when--stats_interval_secondsis set, but latency percentiles were only available in the final aggregate histogram. That made it impossible for the regression harness to report true interval P99/P99.9 latency, because the runner could only parse the final histogram.This diff adds opt-in per-interval latency percentile reporting behind
--report_interval_percentiles. When enabled together with--histogram=1and--stats_interval_seconds > 0, db_bench records per-thread, per-operation histograms for the current interval from the existingStats::FinishedOpspath. At each stats interval boundary, thread 0 merges the worker histograms, prints oneIntervalPercentiles:line per operation type with count, P50, P75, P99, P99.9, and P99.99, and clears the interval histograms for the next interval.The new reporting path is off by default and does not change existing final histogram output. It uses per-thread histogram containers guarded by per-thread locks so workers do not contend on one shared histogram while recording operation latency.
The dependent benchmark harness diff consumes the new
IntervalPercentiles:lines to publish interval latency rows to Scuba.Differential Revision: D115867590