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

mathutil: support exponential average #39484

Merged

Conversation

hawkingrei
Copy link
Member

@hawkingrei hawkingrei commented Nov 30, 2022

Signed-off-by: Weizhen Wang wangweizhen@pingcap.com

What problem does this PR solve?

Issue Number: close #39488

Problem Summary:

What is changed and how it works?

Very useful for cpu scheduling

Check List

Tests

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

Please refer to Release Notes Language Style Guide to write a quality release note.

None

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Nov 30, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • lance6716
  • tangenta

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-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Nov 30, 2022
@hawkingrei
Copy link
Member Author

@tangenta @lance6716 PTAL

Copy link
Contributor

@lance6716 lance6716 left a comment

Choose a reason for hiding this comment

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

rest lgtm

util/mathutil/exponential_average.go Outdated Show resolved Hide resolved
util/mathutil/exponential_average.go Outdated Show resolved Hide resolved
util/mathutil/exponential_average.go Outdated Show resolved Hide resolved
@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Nov 30, 2022
}

// NewExponentialMovingAverage will create a new ExponentialMovingAverage
func NewExponentialMovingAverage(
Copy link
Contributor

@Defined2014 Defined2014 Dec 1, 2022

Choose a reason for hiding this comment

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

Could we add a default param for this struct? It's hard for me to decide what factor and warmupWindow to use in sometime.

Copy link
Member Author

Choose a reason for hiding this comment

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

It is hard. Different businesses have different characteristics. Someone has high sampling rate. so they want to have a less warnup windows. All in all, developer must accord their business characteristics to decide.

@Benjamin2037
Copy link
Collaborator

If we use exponential average, will we be too slow to react high workload? Do we timed in this mode how long it will takes to aware the workload is high?

@hawkingrei hawkingrei force-pushed the add_exponential_average_measurement branch from 81774e9 to 749f19c Compare December 2, 2022 04:50
@hawkingrei hawkingrei requested a review from a team as a code owner December 2, 2022 04:50
@ti-chi-bot ti-chi-bot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Dec 2, 2022
Signed-off-by: Weizhen Wang <wangweizhen@pingcap.com>
Signed-off-by: Weizhen Wang <wangweizhen@pingcap.com>
Signed-off-by: Weizhen Wang <wangweizhen@pingcap.com>
Signed-off-by: Weizhen Wang <wangweizhen@pingcap.com>
Signed-off-by: Weizhen Wang <wangweizhen@pingcap.com>
Signed-off-by: Weizhen Wang <wangweizhen@pingcap.com>
Signed-off-by: Weizhen Wang <wangweizhen@pingcap.com>
@hawkingrei hawkingrei force-pushed the add_exponential_average_measurement branch from 749f19c to 126788a Compare December 2, 2022 04:59
@ti-chi-bot ti-chi-bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Dec 2, 2022
@hawkingrei hawkingrei requested review from Defined2014 and removed request for a team December 2, 2022 05:00
@hawkingrei
Copy link
Member Author

If we use exponential average, will we be too slow to react high workload? Do we timed in this mode how long it will takes to aware the workload is high?

In fact, We provide two paramater to control the behavior. But The paramater are changed according to user's business character characteristics.

@hawkingrei
Copy link
Member Author

@Benjamin2037 @Defined2014 PTAL

Signed-off-by: Weizhen Wang <wangweizhen@pingcap.com>
@hawkingrei
Copy link
Member Author

@tangenta PTAL

Co-authored-by: tangenta <tangenta@126.com>
Co-authored-by: tangenta <tangenta@126.com>
@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Dec 2, 2022
@hawkingrei
Copy link
Member Author

@Benjamin2037 PTAL

@hawkingrei
Copy link
Member Author

/merge

@ti-chi-bot
Copy link
Member

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

Commit hash: 254bbb6

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Dec 2, 2022
@ti-chi-bot ti-chi-bot merged commit c3b89e7 into pingcap:master Dec 2, 2022
@sre-bot
Copy link
Contributor

sre-bot commented Dec 2, 2022

TiDB MergeCI notify

✅ Well Done! New fixed [1] after this pr merged.

CI Name Result Duration Compare with Parent commit
idc-jenkins-ci/integration-cdc-test 🔴 failed 1, success 39, total 40 24 min Existing failure
idc-jenkins-ci-tidb/common-test 🔴 failed 1, success 10, total 11 10 min Existing failure
idc-jenkins-ci-tidb/integration-common-test ✅ all 17 tests passed 13 min Fixed
idc-jenkins-ci-tidb/sqllogic-test-2 🟢 all 28 tests passed 6 min 1 sec Existing passed
idc-jenkins-ci-tidb/tics-test 🟢 all 1 tests passed 5 min 50 sec Existing passed
idc-jenkins-ci-tidb/sqllogic-test-1 🟢 all 26 tests passed 4 min 34 sec Existing passed
idc-jenkins-ci-tidb/integration-ddl-test 🟢 all 6 tests passed 4 min 26 sec Existing passed
idc-jenkins-ci-tidb/mybatis-test 🟢 all 1 tests passed 3 min 47 sec Existing passed
idc-jenkins-ci-tidb/integration-compatibility-test 🟢 all 1 tests passed 2 min 39 sec Existing passed
idc-jenkins-ci-tidb/plugin-test 🟢 build success, plugin test success 4min Existing passed

@hawkingrei hawkingrei deleted the add_exponential_average_measurement branch December 8, 2022 12:04
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/L Denotes a PR that changes 100-499 lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

math: add exponential moving average
7 participants