[improvement](executor) use real elapsed time to compute workload group metrics refresh interval#63224
Closed
bosswnx wants to merge 1 commit into
Closed
[improvement](executor) use real elapsed time to compute workload group metrics refresh interval#63224bosswnx wants to merge 1 commit into
bosswnx wants to merge 1 commit 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: 29887 ms |
Contributor
TPC-DS: Total hot run time: 169899 ms |
Contributor
BE UT Coverage ReportIncrement line coverage Increment coverage report
|
Contributor
BE Regression && UT Coverage ReportIncrement line coverage Increment coverage report
|
Author
|
/review |
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.
Proposed changes
Issue Number: 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, GC pressure orscheduling delays the 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, the divisorupdates 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.What this PR does
Replace 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.
Files changed
be/src/runtime/workload_group/workload_group_metrics.cppbe/src/runtime/workload_group/workload_group_metrics.hKnown limitation / follow-up
On the first invocation after BE startup
_last_refresh_time_msis0,so
interval_secondbecomesMonotonicMillis() / 1000(a very largenumber) and the first sample of each per-second metric will be reported as
near-zero. The values converge to correct readings from the second refresh
onwards. A follow-up can initialize
_last_refresh_time_mstoMonotonicMillis()in the constructor to also make the first sampleaccurate; kept out of this PR to keep the change minimal.
Checklist
(no behavioral change observable from SQL; covered by existing
workload-group metrics tests)
Need backport
Please backport to all maintained branches: