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

statistics: optimize stats delta dumping with batch processing #58791

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

Rustin170506
Copy link
Member

@Rustin170506 Rustin170506 commented Jan 8, 2025

What problem does this PR solve?

Issue Number: close #57869

close #58331

Problem Summary:

What changed and how does it work?

In this PR I changed DumpStatsDeltaToKV to dump the stats in batch instead of one by one. This will significantly improve the performance of the dump process. From my tests, the duration dropped from 40 minutes to 20 seconds under 100m table workload.

See more: #57869 (comment)

Check List

Tests

  • Unit test
  • Integration test
  • Manual test
  • No need to test
    • I checked and no code files have been changed.

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

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

提升 TiDB 在大量表和高负载下 dump stats delta 更新比较慢的问题
Improve TiDB's slow update of dump stats delta under large number of tables and high loads

Signed-off-by: Rustin170506 <techregister@pm.me>
@ti-chi-bot ti-chi-bot bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/planner SIG: Planner size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jan 8, 2025
Signed-off-by: Rustin170506 <techregister@pm.me>
Signed-off-by: Rustin170506 <techregister@pm.me>
Signed-off-by: Rustin170506 <techregister@pm.me>
@ti-chi-bot ti-chi-bot bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jan 8, 2025
Signed-off-by: Rustin170506 <techregister@pm.me>
Copy link

codecov bot commented Jan 8, 2025

Codecov Report

Attention: Patch coverage is 66.11570% with 41 lines in your changes missing coverage. Please review.

Project coverage is 73.8635%. Comparing base (d966219) to head (a3cf47b).
Report is 15 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #58791        +/-   ##
================================================
+ Coverage   73.0741%   73.8635%   +0.7894%     
================================================
  Files          1676       1707        +31     
  Lines        463762     475271     +11509     
================================================
+ Hits         338890     351052     +12162     
+ Misses       104006     102581      -1425     
- Partials      20866      21638       +772     
Flag Coverage Δ
integration 45.6698% <0.0000%> (?)
unit 72.3322% <66.1157%> (+0.0649%) ⬆️

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

Components Coverage Δ
dumpling 52.6910% <ø> (ø)
parser ∅ <ø> (∅)
br 45.7419% <ø> (+0.0059%) ⬆️

… check for batchUpdates

Signed-off-by: Rustin170506 <techregister@pm.me>
@Rustin170506
Copy link
Member Author

/retest

1 similar comment
@Rustin170506
Copy link
Member Author

/retest

Copy link

ti-chi-bot bot commented Jan 8, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: winoros

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Jan 8, 2025
Copy link

ti-chi-bot bot commented Jan 8, 2025

[LGTM Timeline notifier]

Timeline:

  • 2025-01-08 19:15:03.155221866 +0000 UTC m=+381046.444053592: ☑️ agreed by winoros.

@Rustin170506
Copy link
Member Author

Rustin170506 commented Jan 9, 2025

I tested this PR on the real cluster:

image Before this change: image

After this change:
image

…r slow operations

Signed-off-by: Rustin170506 <techregister@pm.me>
…ng operations

Signed-off-by: Rustin170506 <techregister@pm.me>
… and improve performance logging

Signed-off-by: Rustin170506 <techregister@pm.me>
@Rustin170506
Copy link
Member Author

/retest

…erformance

Signed-off-by: Rustin170506 <techregister@pm.me>
Copy link
Member Author

@Rustin170506 Rustin170506 left a comment

Choose a reason for hiding this comment

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

🔢 Self-check (PR reviewed by myself and ready for feedback.)

@Rustin170506 Rustin170506 requested a review from qw4990 January 9, 2025 09:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/planner SIG: Planner size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Excessive Stats Updaing Duration in Clusters with Over One Million Tables and Active Workloads
2 participants