Skip to content

resource_control: support collecting cross AZ traffic in ru consumption#62003

Merged
ti-chi-bot[bot] merged 11 commits into
pingcap:masterfrom
glorv:cross-az-traffic
Jul 4, 2025
Merged

resource_control: support collecting cross AZ traffic in ru consumption#62003
ti-chi-bot[bot] merged 11 commits into
pingcap:masterfrom
glorv:cross-az-traffic

Conversation

@glorv

@glorv glorv commented Jun 25, 2025

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Issue Number: close #62001

Problem Summary:

What changed and how does it work?

Add cross AZ network traffic statistics in ru consumption and add related grafana panels.

This PR depends on tikv/client-go#1669

The new panels snapshot:

image

In comparison, the "coprocessor response size" metrics is as following:

image

NOTE:

  • there are 3 tikvs and 1 tidb instances, 2 tikvs are in different zone and 1 is in the same zone.
  • The cross AZ traffic is slightly higher the the total coprocessor response sizes(of 2 tikv instances) because the request size is also counted.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No need to test
    • I checked and no code files have been changed.

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

None

@glorv glorv requested review from Connor1996, JmPotato and nolouch June 25, 2025 09:33
@ti-chi-bot ti-chi-bot Bot added release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jun 25, 2025
@tiprow

tiprow Bot commented Jun 25, 2025

Copy link
Copy Markdown

Hi @glorv. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@glorv glorv requested a review from guo-shaoge June 25, 2025 09:34
@ti-chi-bot ti-chi-bot Bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jun 25, 2025
@glorv

glorv commented Jun 26, 2025

Copy link
Copy Markdown
Contributor Author

/retest

@tiprow

tiprow Bot commented Jun 26, 2025

Copy link
Copy Markdown

@glorv: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

Details

In response to this:

/retest

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@codecov

codecov Bot commented Jun 26, 2025

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 62.50000% with 6 lines in your changes missing coverage. Please review.

Project coverage is 75.5851%. Comparing base (4c9e2ea) to head (1de7652).
Report is 14 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #62003        +/-   ##
================================================
+ Coverage   72.9269%   75.5851%   +2.6581%     
================================================
  Files          1740       1794        +54     
  Lines        483048     498249     +15201     
================================================
+ Hits         352272     376602     +24330     
+ Misses       109207      98830     -10377     
- Partials      21569      22817      +1248     
Flag Coverage Δ
integration 49.8390% <62.5000%> (?)
unit 72.9607% <62.5000%> (+0.7933%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
dumpling 52.7804% <ø> (ø)
parser ∅ <ø> (∅)
br 63.0744% <ø> (+16.7420%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@glorv

glorv commented Jun 26, 2025

Copy link
Copy Markdown
Contributor Author

@guo-shaoge @nolouch @JmPotato PTAL

Comment thread pkg/session/session.go
ResourceGroupName: sc.ResourceGroupName,
LoadBasedReplicaReadThreshold: vars.LoadBasedReplicaReadThreshold,
RunawayChecker: sc.RunawayChecker,
RUConsumptionReporter: s.GetDomain().(*domain.Domain).ResourceGroupsController(),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just in case, I still want to ask if we won't encounter the same issue as in #61899 (comment) here, right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. The RUConsumptionReporter is always the global ResourceGroupsController which is not changed in the whole lifetime of this instance, so it is different from the pre-statement RunawayCheck.

@ti-chi-bot ti-chi-bot Bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Jun 26, 2025
Comment thread pkg/util/execdetails/execdetails.go Outdated
// GetInterZoneTrafficBytes returns the inter zone network traffic bytes involved
// between tiflash instances.
func (networkTraffic *TiFlashNetworkTrafficSummary) GetInterZoneTrafficBytes() uint64 {
return networkTraffic.interZoneSendBytes + networkTraffic.interZoneReceiveBytes

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add comments to explain why send bytes is used

@glorv

glorv commented Jul 3, 2025

Copy link
Copy Markdown
Contributor Author

@guo-shaoge @nolouch PTAL again, thanks~

@ti-chi-bot ti-chi-bot Bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Jul 3, 2025
@ti-chi-bot

ti-chi-bot Bot commented Jul 3, 2025

Copy link
Copy Markdown

[LGTM Timeline notifier]

Timeline:

  • 2025-06-26 07:15:42.653059944 +0000 UTC m=+947195.376238925: ☑️ agreed by JmPotato.
  • 2025-07-03 22:45:47.547387481 +0000 UTC m=+1607800.270566463: ☑️ agreed by nolouch.

@ti-chi-bot

ti-chi-bot Bot commented Jul 4, 2025

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cfzjywxk, guo-shaoge, JmPotato, nolouch, yudongusa

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot Bot added the approved label Jul 4, 2025
@glorv

glorv commented Jul 4, 2025

Copy link
Copy Markdown
Contributor Author

/retest

@tiprow

tiprow Bot commented Jul 4, 2025

Copy link
Copy Markdown

@glorv: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

Details

In response to this:

/retest

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@glorv

glorv commented Jul 4, 2025

Copy link
Copy Markdown
Contributor Author

/retest

@tiprow

tiprow Bot commented Jul 4, 2025

Copy link
Copy Markdown

@glorv: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

Details

In response to this:

/retest

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@ti-chi-bot ti-chi-bot Bot merged commit cc90d37 into pingcap:master Jul 4, 2025
24 checks passed
@glorv glorv deleted the cross-az-traffic branch July 4, 2025 11:57
morgo added a commit to morgo/tidb that referenced this pull request Jul 7, 2025
* origin/master: (79 commits)
  backend/local: add rate limiter for split region and ingest data (pingcap#61555)
  fix(runaway): resolve the dead channel in UpdateNewAndDoneWatch (pingcap#61795)
  *: collect subtask summary for `IMPORT INTO` tasks (pingcap#61600)
  tests: update vector cluster test result (pingcap#62174)
  planner: change casetest instance-plan-cache test timeout. (pingcap#62195)
  planner: remove data race for instance plan cache (pingcap#62217)
  *: upgrade pd client to fix keyspace issue (pingcap#62189)
  resource_control: support collecting cross AZ traffic in ru consumption (pingcap#62003)
  test: wait for statistics owner to close on exit (pingcap#62198)
  planner: remove the selection above the table dual (pingcap#62193)
  telemetry: add telemetry related code back (pingcap#61753)
  planner: move physical limit related logic into physical op. (pingcap#62187)
  planner: remove useless code (pingcap#61968)
  retry: enhance retry for ingestor on nextgen (pingcap#62191)
  importinto: encode and ingest step use task keyspace in nextgen (pingcap#62138)
  planner: lift the can-push-to-cop check of aggregation/proj (pingcap#62068)
  ddl: cannot panic with failpoint panic in the DDLNotifier (pingcap#62151)
  planner: skip empty expression in the applyPredicateSimplification (pingcap#62178)
  codec: should also return the value even with error because the error may be ignored in the future (pingcap#62175)
  parser: also reduce literal list with charset (pingcap#61484)
  ...
morgo added a commit to morgo/tidb that referenced this pull request Jul 7, 2025
* origin/master: (79 commits)
  backend/local: add rate limiter for split region and ingest data (pingcap#61555)
  fix(runaway): resolve the dead channel in UpdateNewAndDoneWatch (pingcap#61795)
  *: collect subtask summary for `IMPORT INTO` tasks (pingcap#61600)
  tests: update vector cluster test result (pingcap#62174)
  planner: change casetest instance-plan-cache test timeout. (pingcap#62195)
  planner: remove data race for instance plan cache (pingcap#62217)
  *: upgrade pd client to fix keyspace issue (pingcap#62189)
  resource_control: support collecting cross AZ traffic in ru consumption (pingcap#62003)
  test: wait for statistics owner to close on exit (pingcap#62198)
  planner: remove the selection above the table dual (pingcap#62193)
  telemetry: add telemetry related code back (pingcap#61753)
  planner: move physical limit related logic into physical op. (pingcap#62187)
  planner: remove useless code (pingcap#61968)
  retry: enhance retry for ingestor on nextgen (pingcap#62191)
  importinto: encode and ingest step use task keyspace in nextgen (pingcap#62138)
  planner: lift the can-push-to-cop check of aggregation/proj (pingcap#62068)
  ddl: cannot panic with failpoint panic in the DDLNotifier (pingcap#62151)
  planner: skip empty expression in the applyPredicateSimplification (pingcap#62178)
  codec: should also return the value even with error because the error may be ignored in the future (pingcap#62175)
  parser: also reduce literal list with charset (pingcap#61484)
  ...
morgo added a commit to morgo/tidb that referenced this pull request Jul 7, 2025
* origin/master: (79 commits)
  backend/local: add rate limiter for split region and ingest data (pingcap#61555)
  fix(runaway): resolve the dead channel in UpdateNewAndDoneWatch (pingcap#61795)
  *: collect subtask summary for `IMPORT INTO` tasks (pingcap#61600)
  tests: update vector cluster test result (pingcap#62174)
  planner: change casetest instance-plan-cache test timeout. (pingcap#62195)
  planner: remove data race for instance plan cache (pingcap#62217)
  *: upgrade pd client to fix keyspace issue (pingcap#62189)
  resource_control: support collecting cross AZ traffic in ru consumption (pingcap#62003)
  test: wait for statistics owner to close on exit (pingcap#62198)
  planner: remove the selection above the table dual (pingcap#62193)
  telemetry: add telemetry related code back (pingcap#61753)
  planner: move physical limit related logic into physical op. (pingcap#62187)
  planner: remove useless code (pingcap#61968)
  retry: enhance retry for ingestor on nextgen (pingcap#62191)
  importinto: encode and ingest step use task keyspace in nextgen (pingcap#62138)
  planner: lift the can-push-to-cop check of aggregation/proj (pingcap#62068)
  ddl: cannot panic with failpoint panic in the DDLNotifier (pingcap#62151)
  planner: skip empty expression in the applyPredicateSimplification (pingcap#62178)
  codec: should also return the value even with error because the error may be ignored in the future (pingcap#62175)
  parser: also reduce literal list with charset (pingcap#61484)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved lgtm release-note-none Denotes a PR that doesn't merit a release note. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

resource_control: support collecting and reporting cross AZ network traffic

6 participants