-
Notifications
You must be signed in to change notification settings - Fork 4k
metric, deps: fork prometheus repo and improve histogram lookup perf #139594
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
metric, deps: fork prometheus repo and improve histogram lookup perf #139594
Conversation
217f763 to
121e750
Compare
121e750 to
e034e72
Compare
Hypothesis: all the cluster setting customizations in this test are causing flakes and lockups but making subsystems behave in non-standard ways. I ran the test a few times without any settings changes and it seems to run in about the same time or faster than before. It appears that their intention was to make the test "faster" but that doesn't seem to be the case, especially since we don't care to run it under duress. Resolves: cockroachdb#139600 Release note: None
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice like the performance enhancements 👍
One comment
|
|
||
| b.ResetTimer() | ||
|
|
||
| b.Run("insert integers", func(b *testing.B) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you also do a diff for randomly generated values?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done! thx for the suggestion.
Simple benchmark to measure histogram recording performance. Release note: None
This modifies our dependencies to use a forked `client_golang` in order to take some perf shortcuts we can't do via the public API. Resolves: cockroachdb#138930 Part of: cockroachdb#138932 Release note: None
Previously, we would look up the histogram bucket twice. Once for the cumulative histogram, and another time for the windowed. This was unnecessary because we guarantee that the two histograms are always using identical bucket configurations. Once we forked the `client_golang` dependency, and made public the bucket lookup method we were able to call it directly and reuse the lookup result for both observations. Benchmark results: ``` ❯ benchdiff ./pkg/util/metric -b -r 'BenchmarkHistogramRecordValue' -c 10 checking out 'e85968b' building benchmark binaries for e85968b: deps: use forked prometheus/client_golang [bazel=true] 1/1 | checking out '8c28ed3' building benchmark binaries for 8c28ed3: metric: lookup histogram bucket once to update [bazel=true] 1/1 | pkg=1/1 iter=10/10 cockroachdb/cockroach/pkg/util/metric \ name old time/op new time/op delta HistogramRecordValue/insert_integers-10 53.9ns ± 2% 36.4ns ± 0% -32.49% (p=0.000 n=10+10) HistogramRecordValue/random_integers-10 59.1ns ± 1% 43.4ns ± 0% -26.63% (p=0.000 n=9+10) HistogramRecordValue/insert_zero-10 31.6ns ± 1% 29.5ns ± 0% -6.78% (p=0.000 n=10+8) name old alloc/op new alloc/op delta HistogramRecordValue/insert_integers-10 0.00B 0.00B ~ (all equal) HistogramRecordValue/insert_zero-10 0.00B 0.00B ~ (all equal) HistogramRecordValue/random_integers-10 0.00B 0.00B ~ (all equal) name old allocs/op new allocs/op delta HistogramRecordValue/insert_integers-10 0.00 0.00 ~ (all equal) HistogramRecordValue/insert_zero-10 0.00 0.00 ~ (all equal) HistogramRecordValue/random_integers-10 0.00 0.00 ~ (all equal) ``` Resolves: cockroachdb#138932 Release note: None
e034e72 to
d0b60bf
Compare
|
TFTR! bors r=angles-n-daemons |
metric: add histogram benchmark
Simple benchmark to measure histogram recording performance.
Release note: None
deps: use forked prometheus/client_golang
This modifies our dependencies to use a forked
client_golanginorder to take some perf shortcuts we can't do via the public API.
Resolves: #138930
Part of: #138932
Release note: None
metric: lookup histogram bucket once to update
Previously, we would look up the histogram bucket twice. Once for
the cumulative histogram, and another time for the windowed. This was
unnecessary because we guarantee that the two histograms are always
using identical bucket configurations.
Once we forked the
client_golangdependency, and made public thebucket lookup method we were able to call it directly and reuse the
lookup result for both observations.
Benchmark results:
Resolves: #138932
Release note: None