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

Fix scheduler performance regression after adding plugin metrics #117594

Merged
merged 1 commit into from Apr 26, 2023

Conversation

tosi3k
Copy link
Member

@tosi3k tosi3k commented Apr 25, 2023

What type of PR is this?

/kind bug

What this PR does / why we need it:

In #117592 we see that the WithLabelValues generates visible CPU load in scheduler, negatively impacting the pod scheduling throughput.

Instead of performing metric lookup unnecessarily many times, let's cache the particular streams inside the filter and prefilter plugins.

Which issue(s) this PR fixes:

Fixes #117592.

Special notes for your reviewer:

/assign @alculquicondor
/assign @mborsz
/kind bug
/sig scheduling

Does this PR introduce a user-facing change?

Fix 1.27 performance regression in scheduler caused by frequent metric lookup on critical code path.

@k8s-ci-robot k8s-ci-robot added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Apr 25, 2023
@k8s-ci-robot k8s-ci-robot added kind/bug Categorizes issue or PR as related to a bug. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Apr 25, 2023
@k8s-ci-robot k8s-ci-robot added sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Apr 25, 2023
@k8s-ci-robot
Copy link
Contributor

This issue is currently awaiting triage.

If a SIG or subproject determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

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.

@k8s-ci-robot k8s-ci-robot added the needs-priority Indicates a PR lacks a `priority/foo` label and requires one. label Apr 25, 2023
@alculquicondor
Copy link
Member

/priority important-soon

@k8s-ci-robot k8s-ci-robot added priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. and removed needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Apr 25, 2023
@mborsz
Copy link
Member

mborsz commented Apr 26, 2023

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 26, 2023
@mborsz
Copy link
Member

mborsz commented Apr 26, 2023

Thanks!

@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: e6755f451b6c36992939e4ce07997ca394169ee8

pkg/scheduler/framework/runtime/framework.go Show resolved Hide resolved
pkg/scheduler/framework/runtime/framework.go Outdated Show resolved Hide resolved
pkg/scheduler/framework/runtime/framework.go Outdated Show resolved Hide resolved
pkg/scheduler/framework/runtime/framework.go Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 26, 2023
Copy link
Member

@alculquicondor alculquicondor left a comment

Choose a reason for hiding this comment

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

just nits for code consistency

/approve

pkg/scheduler/framework/runtime/instrumented_plugins.go Outdated Show resolved Hide resolved
pkg/scheduler/framework/runtime/framework.go Outdated Show resolved Hide resolved
pkg/scheduler/framework/runtime/framework.go Show resolved Hide resolved
pkg/scheduler/framework/runtime/instrumented_plugins.go Outdated Show resolved Hide resolved
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alculquicondor, tosi3k

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 26, 2023
Copy link
Member

@alculquicondor alculquicondor left a comment

Choose a reason for hiding this comment

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

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 26, 2023
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 288b65e8961dcbc1218e69331ecde83474d8667b

@alculquicondor
Copy link
Member

Please open a cherry-pick for release-1.27

@k8s-ci-robot k8s-ci-robot merged commit c4f6c47 into kubernetes:master Apr 26, 2023
12 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v1.28 milestone Apr 26, 2023
@liggitt liggitt added the kind/regression Categorizes issue or PR as related to a regression from a prior release. label Apr 28, 2023
k8s-ci-robot added a commit that referenced this pull request Apr 28, 2023
…94-upstream-release-1.27

Automated cherry pick of #117594: Fix scheduler performance regression after adding plugin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. kind/regression Categorizes issue or PR as related to a regression from a prior release. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Performance degradation in scheduler after adding metrics for counting plugin evaluation
6 participants