util/metric: add benchmark comparing classic vs native histograms#167487
Open
angles-n-daemons wants to merge 1 commit intocockroachdb:masterfrom
Open
util/metric: add benchmark comparing classic vs native histograms#167487angles-n-daemons wants to merge 1 commit intocockroachdb:masterfrom
angles-n-daemons wants to merge 1 commit intocockroachdb:masterfrom
Conversation
Add BenchmarkClassicVsNativeHistogram to measure the performance
difference between classic Prometheus histograms and native (exponential)
histograms across three axes: sequential observation, parallel
(contended) observation, and quantile computation.
The benchmark tests two bucket configs (IOLatency, Count1K) and three
histogram variants: classic, native-fine (factor=1.1, schema 3), and
native-matched (factor matching the classic growth factor) to isolate
whether the performance gap is driven by bucket count or by the
underlying sync.Map data structure.
Results on Apple M3 Pro (arm64):
Observe (sequential):
classic: ~31 ns/op
native-fine: ~65 ns/op (2.1x)
native-matched: ~64 ns/op (2.1x)
Observe (parallel, 11 goroutines):
classic: ~315 ns/op
native-fine: ~284 ns/op (0.9x)
native-matched: ~289 ns/op (0.9x)
Quantile (p50/p99/p99.9, 10k observations):
classic: ~2.3 us/op
native-fine: ~4.5 us/op (2.0x)
native-matched: ~4.7 us/op (2.0x)
The overhead is a fixed cost of sync.Map vs []uint64, not a function
of bucket count — matching the growth factor does not close the gap.
Epic: none
Release note: None
Co-Authored-By: roachdev-claude <roachdev-claude-bot@cockroachlabs.com>
Contributor
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
Member
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
BenchmarkClassicVsNativeHistogramcomparing classic Prometheus histograms against native (exponential) histograms across sequential observation, parallel observation, and quantile computation.sync.Mapdata structure.sync.Mapvs[]uint64— matching the growth factor does not close the gap.Benchmark Results (Apple M3 Pro, arm64)
Epic: none