Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CDC/etcd_worker: add rate limiter to limit EtcdWorker tick frequency (#3219) #3271

Merged

Conversation

ti-chi-bot
Copy link
Member

This is an automated cherry-pick of #3219

What problem does this PR solve?

#3112
Too frequent etcd worker tick will cause etcd to be overburdened, and the current etcd qps will increase exponentially with the number of tables that need to be replicated.

What is changed and how it works?

Add rate limiter to limit EtcdWorker ticks frequency.

Check List

Tests

  • Manual test (add detailed scripts or steps below)

Summary: Limiting the tick frequency of EtcdWoker can reduce etcd qps by about 50%, but it will reduce the replication speed by about 20%.

Test Environment:

  1. 2 Machines: 8-core 16G memory 500G high-speed disk
  2. Sink Type: mysql
  3. Cluster topo:
pd_servers:
  - host: 172.x.x.x
  - host: 172.x.x.x

tidb_servers:
  - host: 172.x.x.x
  - host: 172.x.x.x
    
tikv_servers:
  - host: 172.x.x.x
  - host: 172.x.x.x

cdc_servers:
  - host: 172.x.x.x
  - host: 172.x.x.x

monitoring_servers:
  - host: 172.x.x.x

grafana_servers:
  - host: 172.x.x.x

alertmanager_servers:
  - host: 172.x.x.x

Test1 (EtcdWorker ticks limit 10 times / s)
Create 16 changefeeds, synchronize a table for each, and write 50w rows of data to each table in upstream.


  Max checkpoint lag Average checkpoint lag in peak Max etcd qps CPU usage Total synchronization time
owner 3.3 min 1.1min 320 164% 4 min
processor - - 160 82% -

Test2 (EtcdWorker ticks limit 10 times / s)
Create 30 changefeeds, synchronize a table for each, and write 50w rows of data to each table in upstream.


  Max checkpoint lag Average checkpoint lag in peak Max etcd qps CPU usage Total synchronization time
owner 6.8 min 5 min 600 189% 10 min
processor - - 300 95% -

Test3 (EtcdWorker ticks without limit )
Create 16 changefeeds, synchronize a table for each, and write 50w rows of data to each table in upstream.


  Max checkpoint lag Average checkpoint lag in peak Max etcd qps CPU usage Total synchronization time
owner 2.74 min 50 s 630 193% 3 min
processor - - 260 92% -

Test4 (EtcdWorker ticks without limit )
Create 30 changefeeds, synchronize a table for each, and write 50w rows of data to each table in upstream.


  Max checkpoint lag Average checkpoint lag in peak Max etcd qps CPU usage Total synchronization time
owner 6.9 min 3 min 1180 199% 8 min
processor - - 600 100% -

Test5 (Incremental scan、EtcdWorker ticks limit 10 times / s)

  1. Create 30 changefeed and pause.
  2. 30 tables are created upstream, and 50w data is written into each table.
  3. After waiting for the upstream data to be written, resume the above 30 changefeeds.
Max checkpoint lag Average checkpoint lag in peak Max etcd qps CPU usage Total synchronization time
owner 7 min 4 min 600 400% 9 min
processor - - 300 200% -

Test6 (Incremental scan、EtcdWorker ticks limit 10 times / s)

  1. Create 30 changefeed and pause.
  2. 30 tables are created upstream, and 50w data is written into each table.
  3. After waiting for the upstream data to be written, resume the above 30 changefeeds.

When resume changefeed, the owner was down instantly.

  Max checkpoint lag Average checkpoint lag in peak Max etcd qps CPU usage Total synchronization time
owner 10 min 7 min 871 400% 10 min
processor - - 658 200% -

Side effects

  • Has exported variable changed.
  • Possible performance regression

Related changes

  • Need to cherry-pick to the release branch

Release note

Please add a release note.
If you don't think this PR needs a release note then fill it with `None`.

@ti-chi-bot ti-chi-bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. do-not-merge/cherry-pick-not-approved labels Nov 4, 2021
@ti-chi-bot
Copy link
Member Author

[REVIEW NOTIFICATION]

This pull request has not been approved.

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

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

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added component/replica-model Replication model component. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. status/LGT2 Indicates that a PR has LGTM 2. type/cherry-pick-for-release-5.3 This PR is cherry-picked to release-5.3 from a source PR. labels Nov 4, 2021
@zhouqiang-cl zhouqiang-cl added the cherry-pick-approved Cherry pick PR approved by release team. label Nov 4, 2021
@overvenus
Copy link
Member

/merge

@ti-chi-bot
Copy link
Member Author

This pull request has been accepted and is ready to merge.

Commit hash: af8cbd9

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Nov 4, 2021
@codecov-commenter
Copy link

Codecov Report

Merging #3271 (af8cbd9) into release-5.3 (6c6ca9e) will decrease coverage by 0.2336%.
The diff coverage is 100.0000%.

@@                 Coverage Diff                 @@
##           release-5.3      #3271        +/-   ##
===================================================
- Coverage      56.7517%   56.5181%   -0.2337%     
===================================================
  Files              211        211                
  Lines            22794      22798         +4     
===================================================
- Hits             12936      12885        -51     
- Misses            8529       8602        +73     
+ Partials          1329       1311        -18     

@ti-chi-bot ti-chi-bot merged commit 4ed1df3 into pingcap:release-5.3 Nov 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-pick-approved Cherry pick PR approved by release team. component/replica-model Replication model component. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. type/cherry-pick-for-release-5.3 This PR is cherry-picked to release-5.3 from a source PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants