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: allocate handles on demand when build table tasks #57940

Merged
merged 2 commits into from
Dec 10, 2024

Conversation

zyguan
Copy link
Contributor

@zyguan zyguan commented Dec 3, 2024

What problem does this PR solve?

Issue Number: ref #56649

Problem Summary: indexWorker.extractTaskHandles will allocate a lot of memory even when there are a few handles.

Let prepare sysbench oltp data with --secondary option and run oltp_point_select workload. The cpu and heap profiles are shown as the following. When calling extractTaskHandles, it's always pre-allocate a large slice for task handles.

image
image

What changed and how does it work?

Simply delay the slice allocation and use the first chunk size as the init capacity.

Here are the benchmark results:

Threads Baseline This PR Diff
15 11490.40 11649.00 1.38%
30 19087.55 19508.61 2.21%
90 23289.24 24352.31 4.56%

20241203-174412

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

@ti-chi-bot ti-chi-bot bot added release-note-none Denotes a PR that doesn't merit a release note. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Dec 3, 2024
Copy link

tiprow bot commented Dec 3, 2024

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.

Copy link

codecov bot commented Dec 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 75.0716%. Comparing base (d6b313f) to head (72c57f1).
Report is 5 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #57940        +/-   ##
================================================
+ Coverage   73.1461%   75.0716%   +1.9254%     
================================================
  Files          1675       1720        +45     
  Lines        461870     471045      +9175     
================================================
+ Hits         337840     353621     +15781     
+ Misses       103283      95323      -7960     
- Partials      20747      22101      +1354     
Flag Coverage Δ
integration 49.2424% <100.0000%> (?)
unit 72.4788% <100.0000%> (+0.2109%) ⬆️

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

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

Copy link
Contributor

@cfzjywxk cfzjywxk left a comment

Choose a reason for hiding this comment

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

Good finding

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

ti-chi-bot bot commented Dec 10, 2024

[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 Dec 10, 2024
Copy link

ti-chi-bot bot commented Dec 10, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-12-04 08:54:40.173458096 +0000 UTC m=+1231467.793112596: ☑️ agreed by cfzjywxk.
  • 2024-12-10 02:12:20.020600834 +0000 UTC m=+318130.109403372: ☑️ agreed by crazycs520.

@cfzjywxk
Copy link
Contributor

/retest

Copy link

tiprow bot commented Dec 10, 2024

@cfzjywxk: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

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.

@cfzjywxk
Copy link
Contributor

/ok-to-test

@ti-chi-bot ti-chi-bot bot added the ok-to-test Indicates a PR is ready to be tested. label Dec 10, 2024
@zyguan
Copy link
Contributor Author

zyguan commented Dec 10, 2024

/retest

@zyguan
Copy link
Contributor Author

zyguan commented Dec 10, 2024

/test fast_test_tiprow

Copy link

ti-chi-bot bot commented Dec 10, 2024

@zyguan: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

/test build
/test check-dev
/test check-dev2
/test mysql-test
/test pull-br-integration-test
/test pull-integration-ddl-test
/test pull-integration-e2e-test
/test pull-lightning-integration-test
/test pull-mysql-client-test
/test pull-unit-test-ddlv1
/test unit-test

The following commands are available to trigger optional jobs:

/test pingcap/tidb/canary_ghpr_unit_test
/test pull-common-test
/test pull-e2e-test
/test pull-integration-common-test
/test pull-integration-copr-test
/test pull-integration-jdbc-test
/test pull-integration-mysql-test
/test pull-integration-nodejs-test
/test pull-integration-python-orm-test
/test pull-sqllogic-test
/test pull-tiflash-test

Use /test all to run the following jobs that were automatically triggered:

pingcap/tidb/ghpr_build
pingcap/tidb/ghpr_check
pingcap/tidb/ghpr_check2
pingcap/tidb/ghpr_mysql_test
pingcap/tidb/ghpr_unit_test
pingcap/tidb/pull_integration_ddl_test
pingcap/tidb/pull_integration_e2e_test
pingcap/tidb/pull_mysql_client_test

In response to this:

/test fast_test_tiprow

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.

Copy link

tiprow bot commented Dec 10, 2024

@ti-chi-bot[bot]: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

  • /test fast_test_tiprow
  • /test fast_test_tiprow_ddlargsv1
  • /test tidb_parser_test

Use /test all to run the following jobs that were automatically triggered:

  • fast_test_tiprow
  • tidb_parser_test

In response to this:

@zyguan: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:

/test build
/test check-dev
/test check-dev2
/test mysql-test
/test pull-br-integration-test
/test pull-integration-ddl-test
/test pull-integration-e2e-test
/test pull-lightning-integration-test
/test pull-mysql-client-test
/test pull-unit-test-ddlv1
/test unit-test

The following commands are available to trigger optional jobs:

/test pingcap/tidb/canary_ghpr_unit_test
/test pull-common-test
/test pull-e2e-test
/test pull-integration-common-test
/test pull-integration-copr-test
/test pull-integration-jdbc-test
/test pull-integration-mysql-test
/test pull-integration-nodejs-test
/test pull-integration-python-orm-test
/test pull-sqllogic-test
/test pull-tiflash-test

Use /test all to run the following jobs that were automatically triggered:

pingcap/tidb/ghpr_build
pingcap/tidb/ghpr_check
pingcap/tidb/ghpr_check2
pingcap/tidb/ghpr_mysql_test
pingcap/tidb/ghpr_unit_test
pingcap/tidb/pull_integration_ddl_test
pingcap/tidb/pull_integration_e2e_test
pingcap/tidb/pull_mysql_client_test

In response to this:

/test fast_test_tiprow

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.

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 Dec 10, 2024

/retest

2 similar comments
@zyguan
Copy link
Contributor Author

zyguan commented Dec 10, 2024

/retest

@zyguan
Copy link
Contributor Author

zyguan commented Dec 10, 2024

/retest

@ti-chi-bot ti-chi-bot bot merged commit 0f869f4 into pingcap:master Dec 10, 2024
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/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants