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

external: set the period of checking merge iter hotspot according to the key size #48063

Merged
merged 3 commits into from
Oct 30, 2023

Conversation

wjhuang2016
Copy link
Member

@wjhuang2016 wjhuang2016 commented Oct 29, 2023

What problem does this PR solve?

Issue Number: close #47923

Problem Summary:
If a hotspot is detected, the reader would change to concurrent mode and read 32M data by default.
If the hotspot shifts to other files, the previous reader will drop the unread byte to release memory. If dropping too many bytes, the whole performance would be very bad.

What is changed and how it works?

Set the period of checking merge iter hotspot according to the key size.
For example, if the average key size is 0.1K (by sampling), then we can check the hotspot every
(32M / 0.1K) = 320000 KVs.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
    before:
image after: image
  • 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.

None

Signed-off-by: wjhuang2016 <huangwenjun1997@gmail.com>
@ti-chi-bot ti-chi-bot bot added release-note-none Denotes a PR that doesn't merit a release note. do-not-merge/needs-tests-checked size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Oct 29, 2023
@codecov
Copy link

codecov bot commented Oct 29, 2023

Codecov Report

Merging #48063 (a803576) into master (3682bd8) will increase coverage by 1.1475%.
Report is 14 commits behind head on master.
The diff coverage is 100.0000%.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #48063        +/-   ##
================================================
+ Coverage   71.6145%   72.7621%   +1.1475%     
================================================
  Files          1401       1424        +23     
  Lines        405923     413847      +7924     
================================================
+ Hits         290700     301124     +10424     
+ Misses        95448      93774      -1674     
+ Partials      19775      18949       -826     
Flag Coverage Δ
integration 42.6365% <0.0000%> (?)
unit 71.5895% <100.0000%> (-0.0250%) ⬇️

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

Components Coverage Δ
dumpling 54.0503% <ø> (ø)
parser ∅ <ø> (∅)
br 48.6316% <100.0000%> (-4.2892%) ⬇️

Signed-off-by: wjhuang2016 <huangwenjun1997@gmail.com>
@ti-chi-bot ti-chi-bot bot added the needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. label Oct 30, 2023
}
// We check the hotspot when the elements size is almost the same as the concurrent reader buffer size.
// So that we don't drop too many bytes if the hotspot shifts to other files.
if sampleKeySize == 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

it's a bit safer to check sampleKeySize/sampleKeyCnt is zero

@ti-chi-bot ti-chi-bot bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Oct 30, 2023
Signed-off-by: wjhuang2016 <huangwenjun1997@gmail.com>
@wjhuang2016
Copy link
Member Author

/retest

@ti-chi-bot
Copy link

ti-chi-bot bot commented Oct 30, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lance6716, tangenta

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 lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Oct 30, 2023
@ti-chi-bot
Copy link

ti-chi-bot bot commented Oct 30, 2023

[LGTM Timeline notifier]

Timeline:

  • 2023-10-30 03:46:37.622695318 +0000 UTC m=+2838395.209805463: ☑️ agreed by lance6716.
  • 2023-10-30 15:59:57.228386382 +0000 UTC m=+2882394.815496527: ☑️ agreed by tangenta.

@ti-chi-bot ti-chi-bot bot merged commit f325595 into pingcap:master Oct 30, 2023
17 of 20 checks passed
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-7.5: #48121.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bad performance for global sort if key is small and has hotspot
4 participants