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

Support binding CPU to isolate query and other threads #3135

Merged
merged 4 commits into from
Oct 8, 2021
Merged

Support binding CPU to isolate query and other threads #3135

merged 4 commits into from
Oct 8, 2021

Conversation

JinheLin
Copy link
Contributor

@JinheLin JinheLin commented Sep 23, 2021

What problem does this PR solve?

Issue Number: close #1720

This PR is the combination of several PRs(#3089 #3107 #3108 #3126) in hotfix-5.1.1-patch1 branch with some compilation problem fixes.

What is changed and how it works?

Proposal: Support binding CPU to isolate query and other threads

What's Changed:

  1. Add singleton CPUAffinityManager to manage CPU affinity of threads by the Linux system call sched_setaffinity .
  2. CPUAffinityManager::bindThreadCPUAffinity would bind threads to different CPUs according to the thread's name after all thread-pools are started.
  3. MPP tasks don't use thread-pool, they create new threads dynamically, so we should set cpu affinity after new threads are created.
  4. The thread-pool of GRPC that MPP tasks used are created dynamically too. Currently, we set cpu affinity in the FlashSerice interface.
  5. This function is disabled by default and you can set configuration cpu.query_cpu_percent between 1~100 to enable it.

Related changes

  • PR to update pingcap/docs/pingcap/docs-cn:
  • Need to cherry-pick to the release branch:

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Side effects

Release note

none

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Sep 23, 2021

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • flowbehappy

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Sep 23, 2021
@JinheLin
Copy link
Contributor Author

/run-all-tests

@flowbehappy
Copy link
Contributor

Looks like this PR fail to compile on MacOS.

In file included from /Users/flow/workspace/github/theflash/storage/ch/dbms/src/Common/CPUAffinityManager.cpp:1:
/Users/flow/workspace/github/theflash/storage/ch/dbms/src/Common/CPUAffinityManager.h:68:21: error: unknown type name 'cpu_set_t'
    void initCPUSet(cpu_set_t & cpu_set, int start, int count);

@ti-chi-bot ti-chi-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 27, 2021
@ti-chi-bot ti-chi-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 29, 2021
@flowbehappy
Copy link
Contributor

flowbehappy commented Sep 29, 2021

I think we don't need to put it into release notes and documents. Because

  • It is difficult to decide the cpu.query_cpu_percent setting by users.
  • We haven't proved that it really works.

So let's make it a hidden feature, only enable it when necessary.

@ti-chi-bot ti-chi-bot added release-note-none Denotes a PR that doesn't merit a release note. and removed release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Oct 8, 2021
Copy link
Contributor

@flowbehappy flowbehappy left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Oct 8, 2021
@JinheLin
Copy link
Contributor Author

JinheLin commented Oct 8, 2021

/merge

@ti-chi-bot
Copy link
Member

@JinheLin: It seems you want to merge this PR, I will help you trigger all the tests:

/run-all-tests

You only need to trigger /merge once, and if the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes.

If you have any questions about the PR merge process, please refer to pr process.

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 ti-community-infra/tichi repository.

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: 43ecbb7

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Oct 8, 2021
@ti-chi-bot
Copy link
Member

@JinheLin: Your PR was out of date, I have automatically updated it for you.

At the same time I will also trigger all tests for you:

/run-all-tests

If the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes.

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 ti-community-infra/tichi repository.

@ti-chi-bot ti-chi-bot merged commit 1738c4e into pingcap:master Oct 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note-none Denotes a PR that doesn't merit a release note. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT1 Indicates that a PR has LGTM 1.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Comprehensive Limiters for IO and CPU
3 participants