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

add min tso scheduler for each resource group #8072

Merged
merged 27 commits into from
Sep 20, 2023

Conversation

guo-shaoge
Copy link
Contributor

@guo-shaoge guo-shaoge commented Sep 8, 2023

What problem does this PR solve?

Issue Number: close #7919

Problem Summary:

What is changed and how it works?

  1. For each resource group, there is a min tso scheduler(move active_set/waiting_set/min_query_id/estimiated_threads inside GroupEntry)
  2. For min tso hard limit, there is a global_estimated_threads_usage.
  3. Attach resource_group_name for each min tso metrics

Check List

Tests

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

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

None

@ti-chi-bot ti-chi-bot bot added release-note-none Denotes a PR that doesn't merit a release note. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Sep 8, 2023
bool updateMinQueryId(const MPPQueryId & query_id, bool retired, const String & msg, LoggerPtr log);
};

void scheduleWaitingQueries(GroupEntry & entry, MPPTaskManager & task_manager, LoggerPtr log);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will call MinTSOScheduler::scheduleImpl(), so should not make it as member function of GroupEntry.

Signed-off-by: guo-shaoge <[email protected]>
Signed-off-by: guo-shaoge <[email protected]>
@guo-shaoge
Copy link
Contributor Author

/run-all-tests

Signed-off-by: guo-shaoge <[email protected]>
@@ -110,11 +110,6 @@ ExecutionResult PipelineExecutor::execute(ResultHandler && result_handler)
}
LOG_TRACE(log, "query finish with {}", exec_context.getQueryProfileInfo().toJson());

// For read_ru, only report it to GAC for now.
LocalAdmissionController::global_instance->consumeResource(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

will consume read_ru in next pr

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Signed-off-by: guo-shaoge <[email protected]>
Signed-off-by: guo-shaoge <[email protected]>
@guo-shaoge
Copy link
Contributor Author

/run-all-tests

@guo-shaoge guo-shaoge changed the title refine MinTSOScheduler for resource control add min tso scheduler for each resource group Sep 14, 2023
Signed-off-by: guo-shaoge <[email protected]>
Signed-off-by: guo-shaoge <[email protected]>
@guo-shaoge
Copy link
Contributor Author

/run-all-tests

Signed-off-by: guo-shaoge <[email protected]>
@guo-shaoge
Copy link
Contributor Author

/run-all-tests

@guo-shaoge
Copy link
Contributor Author

/run-all-tests

dbms/src/Flash/Mpp/MinTSOScheduler.cpp Outdated Show resolved Hide resolved
dbms/src/Flash/Mpp/MinTSOScheduler.cpp Outdated Show resolved Hide resolved
dbms/src/Flash/Mpp/MinTSOScheduler.cpp Show resolved Hide resolved
@guo-shaoge
Copy link
Contributor Author

/run-all-tests

Signed-off-by: guo-shaoge <[email protected]>
dbms/src/Flash/Mpp/MinTSOScheduler.cpp Show resolved Hide resolved
dbms/src/Flash/Mpp/MinTSOScheduler.cpp Show resolved Hide resolved
dbms/src/Flash/Mpp/MinTSOScheduler.h Outdated Show resolved Hide resolved
dbms/src/Flash/Mpp/MinTSOScheduler.cpp Outdated Show resolved Hide resolved
Signed-off-by: guo-shaoge <[email protected]>
Copy link
Contributor

@SeaRise SeaRise left a comment

Choose a reason for hiding this comment

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

Others LGTM

auto elapsed_second = std::chrono::duration_cast<std::chrono::seconds>(elspased).count();
return elapsed_second * fill_rate;
auto elapsed_ms = std::chrono::duration_cast<std::chrono::milliseconds>(elspased).count();
return static_cast<double>(elapsed_ms * fill_rate) / 1000;
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like / 1000 doesn't need to be called multiple times.
fill_rate_ms = fill_rate/1000

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@ti-chi-bot ti-chi-bot bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels Sep 20, 2023
Signed-off-by: guo-shaoge <[email protected]>
Copy link
Contributor

@windtalker windtalker 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
Copy link
Contributor

ti-chi-bot bot commented Sep 20, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: SeaRise, windtalker

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 Sep 20, 2023
@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Sep 20, 2023

[LGTM Timeline notifier]

Timeline:

  • 2023-09-20 04:35:42.460631789 +0000 UTC m=+664908.428219824: ☑️ agreed by SeaRise.
  • 2023-09-20 05:27:39.434944519 +0000 UTC m=+668025.402532554: ☑️ agreed by windtalker.

@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Sep 20, 2023

@guo-shaoge: 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

trigger some heavy tests which will not run always when PR updated.

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 bot merged commit 939a18d into pingcap:master Sep 20, 2023
guo-shaoge added a commit to guo-shaoge/tiflash that referenced this pull request Sep 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm release-note-none Denotes a PR that doesn't merit a release note. 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.

Refine MinTSO when it's used with ResourceControl
3 participants