perf: experiment with striped classic histogram accumulator#2329
Draft
zeitlinger wants to merge 2 commits into
Draft
perf: experiment with striped classic histogram accumulator#2329zeitlinger wants to merge 2 commits into
zeitlinger wants to merge 2 commits into
Conversation
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Contributor
|
1 similar comment
Contributor
|
Contributor
Benchmark resultsBenchmark run succeeded for
Prometheus Java Client BenchmarksRun Information
Comparison with base
Results for PR headCounterBenchmark
HistogramBenchmark
HistogramTextFormatBenchmark
TextFormatUtilBenchmark
Raw ResultsNotes
Benchmark Descriptions
|
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
This is an experimental alternate implementation for benchmarking against
mainand the synchronized candidate in #2252. It is not being presented as production-ready yet.For classic-only histograms, this replaces the existing
Buffer/LongAdderrecording path with an epoch-striped, double-buffered per-thread accumulator. Each recording thread owns a cell, observations update plain thread-confined bucket/count/sum fields, and collection advances a global epoch before draining the inactive buffers. This avoids a globalsynchronized (DataPoint)monitor on the shared four-thread observe path while preserving coherent bucket/count/sum snapshots.getCount()andgetSum()use the same snapshot mechanism.Native-only and hybrid histograms keep their existing implementation. The public API is unchanged.
Local evidence
mise run lint./mvnw -pl prometheus-metrics-core -Dtest=HistogramTest test— 35 tests passed./mvnw -pl prometheus-metrics-core -am verify— reactor passed; core ran 157 testsgit diff --checkHistogramBenchmark.prometheusClassic: 40,944.515 ± 302.666 ops/sThe local JMH number is a smoke result, not a controlled cross-branch conclusion. The
benchmarkworkflow is being requested so this branch andmainare measured on the same runner.Added concurrency coverage
getCount()/getSum()valuesclear()lifecycle behavior for old and newly-created data pointsRemaining hardening before merge consideration
getCount()/getSum(), which currently perform an epoch flip and cell scan to return exact accumulated values.Related: #2252