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

executor: reduce overhead of copystack in idxlookup workers #58705

Merged
merged 3 commits into from
Jan 13, 2025

Conversation

zyguan
Copy link
Contributor

@zyguan zyguan commented Jan 6, 2025

also refine the worker pool

What problem does this PR solve?

Issue Number: ref #56649

Problem Summary: copystack in index lookup workers consume a lot of cpu resources.

image

What changed and how does it work?

Growing the stack at the beginning of the worker goroutine. Also refine the implementation of the worker pool.

image

And here are some benchmark results.

Workload Threads TPS (this PR) TPS (baseline) Diff
idxlookup 32 2797.99 2708.88 3.3%
idxlookup 64 3292.84 3123.35 5.4%

Check List

Tests

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

also refine the worker pool

Signed-off-by: zyguan <zhongyangguan@gmail.com>
@ti-chi-bot ti-chi-bot bot added 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. labels Jan 6, 2025
Copy link

tiprow bot commented Jan 6, 2025

Hi @zyguan. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

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-sigs/prow repository.

@zyguan
Copy link
Contributor Author

zyguan commented Jan 6, 2025

/ok-to-test

@ti-chi-bot ti-chi-bot bot added the ok-to-test Indicates a PR is ready to be tested. label Jan 6, 2025
Signed-off-by: zyguan <zhongyangguan@gmail.com>
Copy link

codecov bot commented Jan 6, 2025

Codecov Report

Attention: Patch coverage is 85.00000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 74.0355%. Comparing base (e79d22f) to head (dba0f17).
Report is 44 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #58705        +/-   ##
================================================
+ Coverage   73.1071%   74.0355%   +0.9284%     
================================================
  Files          1677       1679         +2     
  Lines        463662     477734     +14072     
================================================
+ Hits         338970     353693     +14723     
+ Misses       103866     102681      -1185     
- Partials      20826      21360       +534     
Flag Coverage Δ
integration 42.9040% <75.0000%> (?)
unit 72.4304% <85.0000%> (+0.1465%) ⬆️

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

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

pkg/executor/distsql.go Outdated Show resolved Hide resolved
@ti-chi-bot ti-chi-bot bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Jan 13, 2025
Signed-off-by: zyguan <zhongyangguan@gmail.com>
Copy link

ti-chi-bot bot commented Jan 13, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cfzjywxk, crazycs520

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 [cfzjywxk,crazycs520]

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 Jan 13, 2025
Copy link

ti-chi-bot bot commented Jan 13, 2025

[LGTM Timeline notifier]

Timeline:

  • 2025-01-13 02:46:39.730115281 +0000 UTC m=+753743.018946984: ☑️ agreed by crazycs520.
  • 2025-01-13 03:05:33.976814247 +0000 UTC m=+754877.265645952: ☑️ agreed by cfzjywxk.

}
}

//go:noinline
func growWorkerStack16K() {
Copy link
Contributor

Choose a reason for hiding this comment

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

This feels like 8K. Is that a mistake or something else?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not a mistake, allocating a 8K var on stack requires 16K stack size.

@ti-chi-bot ti-chi-bot bot merged commit 38226ec into pingcap:master Jan 13, 2025
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm ok-to-test Indicates a PR is ready to be tested. 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.

4 participants