tidb icon indicating copy to clipboard operation
tidb copied to clipboard

util: Cgroup monitoring and alerting

Open pingandb opened this issue 1 year ago • 10 comments
trafficstars

What problem does this PR solve?

There isn't yet a mechanism to monitor the cgroup cpu/memory limit and do corresponding alerting.

Issue Number: close #50467

Problem Summary:

What changed and how does it work?

Cgmon pkg was added to periodically watch the cgroup cpu/memory limit setting changes. GOMAXPROCS will be set to the minor one between cgroup limit and maxprocs. Metrics will be set accordingly and displayed on Grafana. New alerting rules were also added for the cpu/memory usage ratio relative to the limits.

Check List

Tests

  • [x] Unit test

  • [x] Integration test

  • [x] Manual test (add detailed scripts or steps below) Grafana display and alerting trigger CPU/Memory Quota will be displayed with the usage graphs as another legend like below (playground on Mac m1, no real data): image

  • [ ] 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

pingandb avatar Jan 16 '24 08:01 pingandb

CLA assistant check
All committers have signed the CLA.

sre-bot avatar Jan 16 '24 08:01 sre-bot

Hi @pingandb. Thanks for your PR.

I'm waiting for a pingcap member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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/test-infra repository.

ti-chi-bot[bot] avatar Jan 16 '24 08:01 ti-chi-bot[bot]

Hi @pingandb. 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.

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/test-infra repository.

tiprow[bot] avatar Jan 16 '24 08:01 tiprow[bot]

/ok-to-test

hawkingrei avatar Jan 16 '24 12:01 hawkingrei

Codecov Report

Merging #50468 (40a33f2) into master (9b4cf39) will decrease coverage by 12.1544%. Report is 387 commits behind head on master. The diff coverage is 66.9491%.

Additional details and impacted files
@@                Coverage Diff                @@
##             master     #50468         +/-   ##
=================================================
- Coverage   72.1075%   59.9531%   -12.1545%     
=================================================
  Files          1452       1588        +136     
  Lines        347481     633428     +285947     
=================================================
+ Hits         250560     379760     +129200     
- Misses        76609     231627     +155018     
- Partials      20312      22041       +1729     
Flag Coverage Δ
integration 41.6081% <55.9322%> (?)
unit 74.5132% <61.1111%> (+2.4056%) :arrow_up:

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

Components Coverage Δ
dumpling 54.0571% <ø> (-2.2558%) :arrow_down:
parser ∅ <ø> (∅)
br 60.1140% <ø> (+7.9208%) :arrow_up:

codecov[bot] avatar Jan 16 '24 13:01 codecov[bot]

@pingandb Thanks for your contribution, could you rebase your branch to solve the conflicts?

wuhuizuo avatar Jan 17 '24 12:01 wuhuizuo

/retest-required

pingandb avatar Feb 21 '24 01:02 pingandb

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hawkingrei, lance6716

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

The pull request process is described here

Needs approval from an approver in each of these files:
  • ~~OWNERS~~ [hawkingrei,lance6716]

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[bot] avatar Mar 08 '24 08:03 ti-chi-bot[bot]

[LGTM Timeline notifier]

Timeline:

  • 2024-02-22 04:51:23.305106954 +0000 UTC m=+505572.052730066: :ballot_box_with_check: agreed by hawkingrei.
  • 2024-03-08 08:27:11.343155196 +0000 UTC m=+414858.365401584: :ballot_box_with_check: agreed by lance6716.

ti-chi-bot[bot] avatar Mar 08 '24 08:03 ti-chi-bot[bot]

/retest

hawkingrei avatar Mar 08 '24 10:03 hawkingrei

@pingandb: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
tiprow_fast_test 40a33f24c8cb17e8ce30f80dd14b62bdeb073956 link true /test tiprow_fast_test
tidb_parser_test 40a33f24c8cb17e8ce30f80dd14b62bdeb073956 link true /test tidb_parser_test

Full PR test history. Your PR dashboard.

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/test-infra repository. I understand the commands that are listed here.

tiprow[bot] avatar Mar 08 '24 10:03 tiprow[bot]