[improvement](executor) use real elapsed time to compute workload group metrics refresh interval#63244
Open
bosswnx wants to merge 2 commits into
Open
[improvement](executor) use real elapsed time to compute workload group metrics refresh interval#63244bosswnx wants to merge 2 commits into
bosswnx wants to merge 2 commits into
Conversation
…up metrics refresh interval Replace the fixed config-based interval with the actual monotonic time delta between two refreshes when calculating per-second CPU and scan IO rates in WorkloadGroupMetrics, so the rates stay accurate even when the refresh thread is delayed or the configured interval is changed at runtime.
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
Author
|
run buildall |
Contributor
TPC-H: Total hot run time: 29661 ms |
Contributor
TPC-DS: Total hot run time: 169745 ms |
Author
|
run buildall |
Contributor
TPC-H: Total hot run time: 29528 ms |
Contributor
TPC-DS: Total hot run time: 171560 ms |
Contributor
BE UT Coverage ReportIncrement line coverage Increment coverage report
|
Contributor
BE UT Coverage ReportIncrement line coverage Increment coverage report
|
Contributor
BE Regression && UT Coverage ReportIncrement line coverage Increment coverage report
|
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.
What problem does this PR solve?
Issue Number: N/A
Related PR: N/A
Problem Summary:
WorkloadGroupMetrics::refresh_metrics()computes per-second CPU time andlocal/remote scan bytes by dividing the delta of each counter by an interval
derived from
config::workload_group_metrics_interval_ms:This is inaccurate for several reasons:
workload_group_metrics_interval_ms. Under BE load or scheduling delaysthe actual gap between two refreshes can drift significantly, but the
divisor is still the configured interval, so the reported per-second
rates do not reflect reality.
workload_group_metrics_interval_msis changed at runtime, thedivisor updates immediately while the counter delta still spans the
old interval, producing a one-shot incorrect rate.
workload_group_metrics_interval_ms < 1000, the integer divisionrounds the divisor down to
0, which would cause a divide-by-zero.This PR replaces the fixed config-based interval with the actual
monotonic time delta between two consecutive
refresh_metrics()invocations:
A new member
std::atomic<uint64_t> _last_refresh_time_ms{0}is added torecord the timestamp of the previous refresh. This makes the per-second
CPU / local-scan / remote-scan metrics reflect the true elapsed wall-clock
interval, regardless of refresh-thread jitter or runtime config changes.
Known limitation: on the very first invocation after BE startup
_last_refresh_time_msis0, sointerval_secondbecomesMonotonicMillis() / 1000(a large number) and the first sample of eachper-second metric will be reported as near-zero. The values converge to
correct readings from the second refresh onwards. A follow-up may
initialize
_last_refresh_time_mstoMonotonicMillis()in theconstructor; kept out of this PR to keep the change minimal.
Release note
None
Check List (For Author)
Test
the per-second-rate divisor with a more accurate value; the
metric semantics, plumbing and existing workload-group metrics
tests remain unchanged.
Behavior changed:
Does this need documentation?