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

sink(ticdc): remove force consume when redo is disabled #5712

Merged
merged 8 commits into from
Jun 9, 2022

Conversation

CharlesCheung96
Copy link
Contributor

@CharlesCheung96 CharlesCheung96 commented Jun 1, 2022

What problem does this PR solve?

Issue Number: close #5453, close #1683

What is changed and how it works?

In order to solve the OOM problem of single table, we refactor flowControl and Sink modules on the basis of splitting transaction, so that they can obtain data in batches and send it to the downstream, which reduces the memory consumption of individual table to constant level:

  1. In flowcontrol module, allocate and release based on resolvedTs and batchID.
  2. In sink module, replace model.Ts with model.ResolvedTs to support batch-based memory release.
  3. In sinkNode, release memory based on checkpointTs and batchID.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)

down stream: TiDB
total row of txn: 30 million
txn size: ~5.4 GB
downstream: tidb cluster
memory of cdc node: 32 GB

The results show that memory consumption of single table is constant. However, a lower quota value may affect throughput, so it is recommended to increase the quota of single tables to 30-40 MB.

image
image
image
image
image
image

compare with #5454
quota: 100MB
down stream: TiDB
total row of txn: 30 million
txn size: ~5.4 GB
downstream: tidb cluster
memory of cdc node: 32 GB

up-TiCDC_2022-06-06T10_33_19.155Z.json.zip

heap_profile.zip

compare with #5454
quota: 35MB
down stream: Kafka
total row of txn: 30 million
txn size: ~5.4 GB
downstream: tidb cluster
memory of cdc node: 32 GB
Test-Cluster-TiCDC-1-12_2022-06-09T11_16_25.947Z.json.zip

Questions

Will it cause performance regression or break compatibility?

No

Do you need to update user documentation, design documentation or monitoring documentation?

No

Release note

`Optimize the memory consumption required for TiCDC to process large transactions`.

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Jun 1, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • amyangfei
  • asddongmen

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 do-not-merge/needs-linked-issue release-note Denotes a PR that will be considered when it comes time to generate release notes. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels Jun 1, 2022
@CharlesCheung96
Copy link
Contributor Author

/run-all-tests

@ti-chi-bot ti-chi-bot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Jun 1, 2022
@CharlesCheung96 CharlesCheung96 changed the title sink(ticdc): Remove force consume sink(ticdc): remove force consume Jun 2, 2022
@CharlesCheung96 CharlesCheung96 changed the title sink(ticdc): remove force consume sink(ticdc): remove force consume when redo is disabled Jun 2, 2022
@nongfushanquan
Copy link
Contributor

/cc @hi-rustin @hicqu

@CharlesCheung96 CharlesCheung96 marked this pull request as ready for review June 6, 2022 10:39
@ti-chi-bot ti-chi-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 6, 2022
Copy link
Contributor

@nongfushanquan nongfushanquan left a comment

Choose a reason for hiding this comment

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

could you add some comments to explain the method to solve the problem

@CharlesCheung96
Copy link
Contributor Author

could you add some comments to explain the method to solve the problem

Done, PTAL.

cdc/model/mounter.go Outdated Show resolved Hide resolved
cdc/model/mounter.go Outdated Show resolved Hide resolved
cdc/model/mounter.go Show resolved Hide resolved
cdc/sink/flowcontrol/flow_control.go Show resolved Hide resolved
@amyangfei amyangfei added the area/ticdc Issues or PRs related to TiCDC. label Jun 7, 2022
@3AceShowHand 3AceShowHand self-requested a review June 8, 2022 06:26
cdc/model/mounter.go Outdated Show resolved Hide resolved
@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Jun 9, 2022
@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Jun 9, 2022
@CharlesCheung96
Copy link
Contributor Author

/hold

@ti-chi-bot ti-chi-bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 9, 2022
@CharlesCheung96
Copy link
Contributor Author

/run-all-tests

@codecov-commenter
Copy link

codecov-commenter commented Jun 9, 2022

Codecov Report

Merging #5712 (e4ba9d5) into master (b9773ac) will increase coverage by 0.0982%.
The diff coverage is 62.1621%.

❗ Current head e4ba9d5 differs from pull request most recent head 4ef0e31. Consider uploading reports for the commit 4ef0e31 to get more accurate results

Flag Coverage Δ
cdc 62.1435% <66.6666%> (+0.2122%) ⬆️
dm 51.9454% <52.0833%> (+0.0265%) ⬆️
engine 61.6326% <70.5882%> (+0.0394%) ⬆️

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

@@               Coverage Diff                @@
##             master      #5712        +/-   ##
================================================
+ Coverage   56.9653%   57.0635%   +0.0982%     
================================================
  Files           681        682         +1     
  Lines         79903      79995        +92     
================================================
+ Hits          45517      45648       +131     
+ Misses        30106      30069        -37     
+ Partials       4280       4278         -2     

@CharlesCheung96
Copy link
Contributor Author

/unhold

@ti-chi-bot ti-chi-bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 9, 2022
@amyangfei
Copy link
Contributor

/merge

@ti-chi-bot
Copy link
Member

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

Commit hash: 4ef0e31

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Jun 9, 2022
@ti-chi-bot ti-chi-bot merged commit b63c2e6 into pingcap:master Jun 9, 2022
CharlesCheung96 added a commit to ti-chi-bot/tiflow that referenced this pull request Jul 1, 2022
CharlesCheung96 added a commit to ti-chi-bot/tiflow that referenced this pull request Jul 6, 2022
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. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XXL Denotes a PR that changes 1000+ 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make mysql sink batch flush data to alleviate OOM problems CDC Synchronize big transaction is too slow
7 participants