-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
*: speed up create table
and reduce memory usage when the number of tables is relatively large
#49371
Conversation
Hi @zimulala. Thanks for your PR. PRs from untrusted users cannot be marked as trusted with I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #49371 +/- ##
================================================
+ Coverage 71.0590% 71.6073% +0.5482%
================================================
Files 1368 1417 +49
Lines 401946 424599 +22653
================================================
+ Hits 285619 304044 +18425
- Misses 96463 101586 +5123
+ Partials 19864 18969 -895
Flags with carried forward coverage won't be shown. Click here to find out more.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
12-14s is still not good enough IMO 🤔 Can you leave the issue open? Maybe others can try different solutions for it.
This is a solution with relatively small changes and relatively large benefits. As for the other possible optimizations, they are more complex (the root cause may be JSON unmarshal problems) and may not have a good solution in the short term. Subsequent optimization may be more like #19177. |
[LGTM Timeline notifier]Timeline:
|
/rebuild |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: crazycs520, Defined2014, lance6716, okJiang, tangenta, tiancaiamao 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:
Approvers can indicate their approval by writing |
/retest-required |
@zimulala: Cannot trigger testing until a trusted user reviews the PR and leaves an In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
create table
when the number of tables is relatively largecreate table
and reduce memory usage when the number of tables is relatively large
In response to a cherrypick label: new pull request created to branch |
What problem does this PR solve?
Issue Number: close #49370
Problem Summary:
ListTables
took a lot of time when the number of tables was relatively largeWhat changed and how does it work?
Because the unmarshal of the
TableInfo
structure takes a large proportion of time, we only needn't all structures of theTableInfo
. So we useTableNameInfo
instead of it.Check List
Tests
Memory usage
Before this PR, when the 113k table is created, TiDB OOM (14G+) appears.
After this PR, the maximum memory of TiDB is nearly 6.9G when creating 113k tables, and the maximum memory usage is 11G when 400k tables are created
Time taken
Execute
checkTableNotExistsFromStore
function consumption of time.Master branch info:

After this PR info(The middle area is particularly high because the owner of another service is transferred):

Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.