CDC/etcd_worker: add rate limiter to limit EtcdWorker tick frequency (#3219) #3269
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.
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
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:
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.
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.
Test3 (EtcdWorker ticks without limit )
Create 16 changefeeds, synchronize a table for each, and write 50w rows of data to each table in upstream.
Test4 (EtcdWorker ticks without limit )
Create 30 changefeeds, synchronize a table for each, and write 50w rows of data to each table in upstream.
Test5 (Incremental scan、EtcdWorker ticks limit 10 times / s)
Test6 (Incremental scan、EtcdWorker ticks limit 10 times / s)
When resume changefeed, the owner was down instantly.
Side effects
Related changes
Release note