Repository navigation
perf: avoid copying YCSB latency slices in final reports - #273
Merged
Merged
Conversation
Signed-off-by: Perfloop Agent <[email protected]>
Signed-off-by: Perfloop Agent <[email protected]>
ovaistariq
approved these changes
Sep 9, 2026
|
🎉 This PR is included in version 1.14.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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.
GetPerOperationStatscopies every per-operation latency slice before sorting percentile values. The final report runs after the YCSB workers finish, so this copy is avoidable.Fix
Take the collector's exclusive lock while final statistics are computed and sort each owned latency slice in place. Counts, errors, averages, and percentiles stay unchanged; the collector's internal latency order remains private. The exclusive lock serializes recording with report generation, which is covered by the concurrent test.
Add YCSB tests and benchmarks for statistic preservation and the complete
RunYCSBWithContextpath at 1K, 100K, and 1M operations. The benchmark profiles allocation through the real final report and times the statistics step instead of using a synthetic display fixture. An unexported hook defaults to the existing statistics method and is used only by the same-package benchmark.Verification
make lintmake install-protoc-plugins && PATH="$(go env GOPATH)/bin:$PATH" make test-client TESTFLAGS='-race'make license-checkWorkload:
ordinary read-only YCSB final report at cfg.NumOps=1K with one-byte values; per-report alloc_space attributed to GetPerOperationStatsreport_alloc_space_bytesWorkload:
ordinary read-only YCSB final report at cfg.NumOps=100K with one-byte values; per-report alloc_space attributed to GetPerOperationStatsreport_alloc_space_bytesGenerated by Perfloop. Measurements and checks.
Note
Low Risk
YCSB benchmark metrics only; behavior is preserved with added concurrency coverage, and production use is effectively post-run final reporting.
Overview
GetPerOperationStatsno longer copies each per-operation latency slice before computing percentiles. It takes an exclusive lock, sorts the collector’s owned slices in place, and documents that internal slice order is not part of the public contract. Reported counts, errors, averages, and percentiles are unchanged; large final reports see much lower allocation (per PR measurements).Adds
metrics_test.go: correctness tests (including repeated calls and concurrent record vs. stats), plus benchmarks forGetPerOperationStats, fullRunYCSBWithContextfinal reporting, andDisplayFinalResultsWithMetricsat 1K–1M ops.progress_pterm.goroutes the final per-operation table through a same-packagegetPerOperationStatsForReporthook (defaults toGetPerOperationStats) so benchmarks can time the real stats step without changing output.Reviewed by Cursor Bugbot for commit 121d148. Bugbot is set up for automated code reviews on this repo. Configure here.