Add CPU and scheduled time timeline to operator metrics#29016
Open
lukasz-stec wants to merge 1 commit intotrinodb:masterfrom
Open
Add CPU and scheduled time timeline to operator metrics#29016lukasz-stec wants to merge 1 commit intotrinodb:masterfrom
lukasz-stec wants to merge 1 commit intotrinodb:masterfrom
Conversation
67c610a to
2951467
Compare
Introduces ResourceUsageTimeSeriesRecorder, a fixed-size bucketed sampler that doubles its bucket width as operator execution grows. CPU and wall time are recorded across addInput, getOutput, and finish phases, merged into a single snapshot, and surfaced as "CPU and scheduled time usage over time" in operator metrics. JMH benchmark results show small overhead. Benchmark (operatorCount) (randomBucketWidth) (randomStartTime) (recordDelayMillis) (resourceTimeSeries) (snapshotCount) Mode Cnt Score Error Units BenchmarkResourceUsageTimeSeriesRecorder.merge N/A false false N/A N/A 2 avgt 20 222.676 ± 1.748 ns/op BenchmarkResourceUsageTimeSeriesRecorder.merge N/A false false N/A N/A 10 avgt 20 402.062 ± 6.396 ns/op BenchmarkResourceUsageTimeSeriesRecorder.merge N/A false false N/A N/A 100 avgt 20 3616.961 ± 210.224 ns/op BenchmarkResourceUsageTimeSeriesRecorder.merge N/A false true N/A N/A 2 avgt 20 277.844 ± 1.140 ns/op BenchmarkResourceUsageTimeSeriesRecorder.merge N/A false true N/A N/A 10 avgt 20 1024.055 ± 5.733 ns/op BenchmarkResourceUsageTimeSeriesRecorder.merge N/A false true N/A N/A 100 avgt 20 11280.448 ± 824.108 ns/op BenchmarkResourceUsageTimeSeriesRecorder.merge N/A true false N/A N/A 2 avgt 20 258.718 ± 2.311 ns/op BenchmarkResourceUsageTimeSeriesRecorder.merge N/A true false N/A N/A 10 avgt 20 748.176 ± 7.178 ns/op BenchmarkResourceUsageTimeSeriesRecorder.merge N/A true false N/A N/A 100 avgt 20 7295.883 ± 295.682 ns/op BenchmarkResourceUsageTimeSeriesRecorder.merge N/A true true N/A N/A 2 avgt 20 308.245 ± 3.080 ns/op BenchmarkResourceUsageTimeSeriesRecorder.merge N/A true true N/A N/A 10 avgt 20 926.292 ± 3.346 ns/op BenchmarkResourceUsageTimeSeriesRecorder.merge N/A true true N/A N/A 100 avgt 20 9384.697 ± 162.079 ns/op BenchmarkResourceUsageTimeSeriesRecorder.operatorStatsAdd 2 N/A N/A N/A false N/A avgt 20 4879.238 ± 5.494 ns/op BenchmarkResourceUsageTimeSeriesRecorder.operatorStatsAdd 2 N/A N/A N/A true N/A avgt 20 5559.705 ± 40.382 ns/op BenchmarkResourceUsageTimeSeriesRecorder.operatorStatsAdd 10 N/A N/A N/A false N/A avgt 20 92375.376 ± 233.255 ns/op BenchmarkResourceUsageTimeSeriesRecorder.operatorStatsAdd 10 N/A N/A N/A true N/A avgt 20 94436.608 ± 422.369 ns/op BenchmarkResourceUsageTimeSeriesRecorder.operatorStatsAdd 100 N/A N/A N/A false N/A avgt 20 1416322.264 ± 9655.329 ns/op BenchmarkResourceUsageTimeSeriesRecorder.operatorStatsAdd 100 N/A N/A N/A true N/A avgt 20 1421749.822 ± 7786.944 ns/op BenchmarkResourceUsageTimeSeriesRecorder.record N/A N/A N/A 100 N/A N/A avgt 20 34.609 ± 0.020 ns/op BenchmarkResourceUsageTimeSeriesRecorder.record N/A N/A N/A 500 N/A N/A avgt 20 34.709 ± 0.048 ns/op BenchmarkResourceUsageTimeSeriesRecorder.record N/A N/A N/A 1000 N/A N/A avgt 20 34.755 ± 0.090 ns/op BenchmarkResourceUsageTimeSeriesRecorder.record N/A N/A N/A 2000 N/A N/A avgt 20 34.771 ± 0.077 ns/op BenchmarkResourceUsageTimeSeriesRecorder.record N/A N/A N/A 32000 N/A N/A avgt 20 34.678 ± 0.030 ns/op
2951467 to
3690351
Compare
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.
Description
Introduces ResourceUsageTimeSeriesRecorder, a fixed-size bucketed sampler that doubles its bucket width as operator execution grows. CPU and wall time are recorded across addInput, getOutput, and finish phases, merged into a single snapshot, and surfaced as "CPU and scheduled time usage over time" in operator metrics.
JMH benchmark results show small overhead.
The operator metric serializes to json like:
It enables visualizations like this:

Additional context and related issues
Release notes
( ) This is not user-visible or is docs only, and no release notes are required.
( X) Release notes are required. Please propose a release note for me.
( ) Release notes are required, with the following suggested text: