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) #3267

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
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 release-note Denotes a PR that will be considered when it comes time to generate release notes. do-not-merge/cherry-pick-not-approved 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-4.0 This PR is cherry-picked to release-4.0 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: 44660b1

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Nov 4, 2021
@amyangfei amyangfei added the area/ticdc Issues or PRs related to TiCDC. label Nov 5, 2021
@asddongmen
Copy link
Contributor

/run-integration-tests

@codecov-commenter
Copy link

Codecov Report

Merging #3267 (44660b1) into release-4.0 (753073a) will increase coverage by 3.6422%.
The diff coverage is 67.1586%.

@@                 Coverage Diff                 @@
##           release-4.0      #3267        +/-   ##
===================================================
+ Coverage      53.7661%   57.4083%   +3.6422%     
===================================================
  Files              153        165        +12     
  Lines            15958      19586      +3628     
===================================================
+ Hits              8580      11244      +2664     
- Misses            6475       7262       +787     
- Partials           903       1080       +177     

@ti-chi-bot ti-chi-bot merged commit 0ec8c88 into pingcap:release-4.0 Nov 5, 2021
@zhouqiang-cl zhouqiang-cl added this to the v4.0.16 milestone Dec 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ticdc Issues or PRs related to TiCDC. 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-4.0 This PR is cherry-picked to release-4.0 from a source PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants