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

codec(ticdc): reduce canal-json decode memory consumption by using buffered json decoder #11911

Merged
merged 15 commits into from
Dec 24, 2024

Conversation

3AceShowHand
Copy link
Contributor

@3AceShowHand 3AceShowHand commented Dec 19, 2024

What problem does this PR solve?

Issue Number: ref #11894

This is the second part to reduce the memory cost by the canal-json decoder when works with the consumer.

What is changed and how it works?

  • use json decoder to decode events, this looks takes relative little memory than the Unmarshal method, but still takes a lot.
  • add CanalJSONTxnDecoder, split related logic, to simplify the normal canal-json decoder.
image
  • After this PR, JSON decoder phase takes around 40% memory. Previous takes more than 60%.

Check List

Tests

  • Unit test
  • Integration test

Questions

Will it cause performance regression or break compatibility?
Do you need to update user documentation, design documentation or monitoring documentation?

Release note

`None`

@ti-chi-bot ti-chi-bot bot added release-note-none Denotes a PR that doesn't merit a release note. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Dec 19, 2024
@wk989898
Copy link
Collaborator

How much memory will be reduced after applying this?

@3AceShowHand
Copy link
Contributor Author

How much memory will be reduced after applying this?

previous, takes around 62%. now takes around 40%.

I tried several json library, all takes a lot of memory in the consumer scenario.

@ti-chi-bot ti-chi-bot bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels Dec 19, 2024
Copy link
Contributor

ti-chi-bot bot commented Dec 19, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: asddongmen, wk989898

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 [asddongmen,wk989898]

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 ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Dec 19, 2024
Copy link
Contributor

ti-chi-bot bot commented Dec 19, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-12-19 10:27:50.924353079 +0000 UTC m=+1125461.013155622: ☑️ agreed by wk989898.
  • 2024-12-19 10:34:56.376733801 +0000 UTC m=+1125886.465536343: ☑️ agreed by asddongmen.

@3AceShowHand
Copy link
Contributor Author

/retest

@3AceShowHand
Copy link
Contributor Author

/retest

@3AceShowHand
Copy link
Contributor Author

/retest

2 similar comments
@3AceShowHand
Copy link
Contributor Author

/retest

@3AceShowHand
Copy link
Contributor Author

/retest

@3AceShowHand
Copy link
Contributor Author

/retest

2 similar comments
@3AceShowHand
Copy link
Contributor Author

/retest

@3AceShowHand
Copy link
Contributor Author

/retest

@ti-chi-bot ti-chi-bot bot merged commit 3f1ab7e into pingcap:master Dec 24, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm release-note-none Denotes a PR that doesn't merit a release note. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants