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: calibrate resource support tpch10 #47095

Merged
merged 24 commits into from
Sep 22, 2023

Conversation

guo-shaoge
Copy link
Collaborator

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

What problem does this PR solve?

Issue Number: close #47094

Problem Summary: part of tiflash resource control

What is changed and how it works?

  1. static calibrate: use tpch10 with 10 concurrency as workload. And run for 20seconds on local machine(20cores)
MySQL [test]> calibrate resource workload TPCH_10;
+--------+
| QUOTA  |
+--------+
| 308306 |
+--------+
1 row in set (0.018 sec)
  1. dynamic calibrate: just like the original logic.
    1. RU_PER_SEC = RU/(cpu_usage/total_logical_core)

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

Signed-off-by: guo-shaoge <shaoge1994@163.com>
Signed-off-by: guo-shaoge <shaoge1994@163.com>
Signed-off-by: guo-shaoge <shaoge1994@163.com>
Signed-off-by: guo-shaoge <shaoge1994@163.com>
Signed-off-by: guo-shaoge <shaoge1994@163.com>
Signed-off-by: guo-shaoge <shaoge1994@163.com>
Signed-off-by: guo-shaoge <shaoge1994@163.com>
Signed-off-by: guo-shaoge <shaoge1994@163.com>
Signed-off-by: guo-shaoge <shaoge1994@163.com>
Signed-off-by: guo-shaoge <shaoge1994@163.com>
Signed-off-by: guo-shaoge <shaoge1994@163.com>
@ti-chi-bot ti-chi-bot bot added do-not-merge/needs-tests-checked 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. and removed do-not-merge/needs-tests-checked labels Sep 19, 2023
Signed-off-by: guo-shaoge <shaoge1994@163.com>
@codecov
Copy link

codecov bot commented Sep 19, 2023

Codecov Report

Merging #47095 (7958a49) into master (9626556) will decrease coverage by 0.4223%.
Report is 27 commits behind head on master.
The diff coverage is 59.8130%.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #47095        +/-   ##
================================================
- Coverage   73.0374%   72.6152%   -0.4223%     
================================================
  Files          1338       1361        +23     
  Lines        399306     408150      +8844     
================================================
+ Hits         291643     296379      +4736     
- Misses        88826      93042      +4216     
+ Partials      18837      18729       -108     
Flag Coverage Δ
integration 32.3230% <1.9047%> (?)
unit 73.0563% <59.8130%> (+0.0188%) ⬆️

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

Components Coverage Δ
dumpling 53.9913% <ø> (ø)
parser 84.9473% <0.0000%> (-0.0148%) ⬇️
br 48.5054% <ø> (-4.5966%) ⬇️

Signed-off-by: guo-shaoge <shaoge1994@163.com>
Signed-off-by: guo-shaoge <shaoge1994@163.com>
Signed-off-by: guo-shaoge <shaoge1994@163.com>
Signed-off-by: guo-shaoge <shaoge1994@163.com>
Signed-off-by: guo-shaoge <shaoge1994@163.com>
Signed-off-by: guo-shaoge <shaoge1994@163.com>
// read bytes: 401799161689.0 / 20 / 20 = 1004497904.22
const cpuTimePerCPUPerSec float64 = 263.74
const readBytesPerCPUPerSec float64 = 1004497904.22
ruPerCPU := float64(ruCfg.CPUMsCost)*cpuTimePerCPUPerSec + float64(ruCfg.ReadBytesCost)*readBytesPerCPUPerSec
Copy link
Contributor

Choose a reason for hiding this comment

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

An additional question: Is the cost factor used by Tiflash to calculate RU obtained from PD?

Copy link
Collaborator Author

@guo-shaoge guo-shaoge Sep 20, 2023

Choose a reason for hiding this comment

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

No, the number is by checking tiflash log(105494.666484 and 401799161689.0)

executor/internal/calibrateresource/calibrate_resource.go Outdated Show resolved Hide resolved
@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Sep 20, 2023
Signed-off-by: guo-shaoge <shaoge1994@163.com>
@CabinfeverB
Copy link
Contributor

/test unit-test

@tiprow
Copy link

tiprow bot commented Sep 20, 2023

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

  • /test tiprow_fast_test

Use /test all to run all jobs.

In response to this:

/test unit-test

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/test-infra repository.

@guo-shaoge
Copy link
Collaborator Author

/run-unit-test

Signed-off-by: guo-shaoge <shaoge1994@163.com>
@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

ti-chi-bot bot commented Sep 20, 2023

[LGTM Timeline notifier]

Timeline:

  • 2023-09-20 08:05:44.327661423 +0000 UTC m=+677510.295249474: ☑️ agreed by CabinfeverB.
  • 2023-09-20 16:04:05.002442887 +0000 UTC m=+706210.970030963: ☑️ agreed by nolouch.

Copy link
Contributor

@HuSharp HuSharp left a comment

Choose a reason for hiding this comment

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

return nil
}

func (e *Executor) getTiDBQuota(ctx context.Context, exec sqlexec.RestrictedSQLExecutor, startTs, endTs time.Time) (float64, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like it includes TiKV Quota, does it make sense to be called getTiDBQuota?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

maybe getTiDBAndTiKVQuota ?

quota := sum / float64(upperBound-lowerBound)
req.AppendUint64(0, uint64(quota))
return nil
return sum / float64(upperBound-lowerBound), nil
Copy link
Contributor

Choose a reason for hiding this comment

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

Could upperBound-lowerBound be zero?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It cannot be zero.
because len(quotas) >= 2. So len(quotas) must be greater than round(0.1*len(quotas))

@easonn7
Copy link

easonn7 commented Sep 21, 2023

/approve

There is no sysvar change.

@ti-chi-bot
Copy link

ti-chi-bot bot commented Sep 21, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: CabinfeverB, easonn7, nolouch, wshwsh12, XuHuaiyu

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 the approved label Sep 21, 2023
@guo-shaoge
Copy link
Collaborator Author

/retest

1 similar comment
@guo-shaoge
Copy link
Collaborator Author

/retest

@guo-shaoge
Copy link
Collaborator Author

/hold

@ti-chi-bot ti-chi-bot bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 21, 2023
@guo-shaoge guo-shaoge removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 21, 2023
Signed-off-by: guo-shaoge <shaoge1994@163.com>
@guo-shaoge
Copy link
Collaborator Author

/retest

3 similar comments
@wuhuizuo
Copy link
Contributor

/retest

@guo-shaoge
Copy link
Collaborator Author

/retest

@guo-shaoge
Copy link
Collaborator Author

/retest

Signed-off-by: guo-shaoge <shaoge1994@163.com>
@guo-shaoge
Copy link
Collaborator Author

/rebuild

@guo-shaoge
Copy link
Collaborator Author

/retest

@ti-chi-bot ti-chi-bot bot merged commit 7a116f3 into pingcap:master Sep 22, 2023
12 of 16 checks passed
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/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

calibrate resource support tpch10
8 participants