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

Start informers after leader election #115754

Merged
merged 1 commit into from
May 15, 2023
Merged

Conversation

linxiulei
Copy link
Contributor

@linxiulei linxiulei commented Feb 14, 2023

If scheduler fails to be elected, it should not start informers so that to avoid memory overhead.

Signed-off-by: Eric Lin exlin@google.com

What type of PR is this?

/kind bug

What this PR does / why we need it:

Improve kube-scheduler memory efficiency

Which issue(s) this PR fixes:

Fixes #115753

Special notes for your reviewer:

Does this PR introduce a user-facing change?

Added new config option `delayCacheUntilActive` to `KubeSchedulerConfiguration` that can provide a tradeoff between memory efficiency and scheduling speed when their leadership is updated in `kube-scheduler`

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. kind/bug Categorizes issue or PR as related to a bug. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Feb 14, 2023
@k8s-ci-robot
Copy link
Contributor

Hi @linxiulei. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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 needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Feb 14, 2023
@aojea
Copy link
Member

aojea commented Feb 14, 2023

/ok-to-test
/lgtm
/assign @alculquicondor

@k8s-ci-robot k8s-ci-robot added the ok-to-test Indicates a non-member PR verified by an org member that is safe to test. label Feb 14, 2023
@k8s-ci-robot k8s-ci-robot removed the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Feb 14, 2023
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 14, 2023
@alculquicondor
Copy link
Member

I'm not convinced this is a bug.

Having the caches ready to go implies that when a scheduler goes down, a second one immediately picks up.

Not sure who take this decision initially or if a pro-con analysis was performed. Invoking @wojtek-t as he was involved in #45453

@aojea
Copy link
Member

aojea commented Feb 14, 2023

Having the caches ready to go implies that when a scheduler goes down, a second one immediately picks up.

/lgtm cancel

that is an good point indeed

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 14, 2023
@linxiulei
Copy link
Contributor Author

Not sure who take this decision initially or if a pro-con analysis was performed. Invoking @wojtek-t as he was involved in #45453

I investigated it a bit. As far as I could see for other components (eg. KCM), they only start caching after leader election. Maybe scheduler is very latency sensitive but IMHO, I'd prefer memory efficiency than scheduling latency here.

@alculquicondor
Copy link
Member

I'd prefer memory efficiency than scheduling latency here.

Sounds like it should be an option. Not everyone would be happy with this.

@kerthcet
Copy link
Member

kerthcet commented Feb 15, 2023

I think quick failover is important for HA, so prefer to keep it as it-is. I would not take it a bug.
/remove-kind bug
/kind cleanup ?

@k8s-ci-robot k8s-ci-robot added kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. and removed kind/bug Categorizes issue or PR as related to a bug. labels Feb 15, 2023
@k8s-ci-robot
Copy link
Contributor

@kerthcet: The label(s) kind/? cannot be applied, because the repository doesn't have them.

In response to this:

I think quick failover is important for HA, so prefer to keep the change. I would not take it a bug.
/remove-kind bug
/kind cleanup ?

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.

Copy link
Member

@liggitt liggitt left a comment

Choose a reason for hiding this comment

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

one suggestion on the config field doc to avoid double negatives, lgtm otherwise

staging/src/k8s.io/kube-scheduler/config/v1/types.go Outdated Show resolved Hide resolved
@liggitt
Copy link
Member

liggitt commented May 15, 2023

/lgtm
/approve

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

LGTM label has been added.

Git tree hash: d298ea32aaebb28f0a3c101898b2e3a14b8cffa4

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alculquicondor, liggitt, linxiulei

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 May 15, 2023
…tion

If scheduler fails to be active (elected if leader election is enabled),
setting this option will not start informers so that to avoid memory
overhead.

Signed-off-by: Eric Lin <exlin@google.com>
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 15, 2023
@liggitt
Copy link
Member

liggitt commented May 15, 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 May 15, 2023
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: ac721a233a7833ce7415e588e8dced9891d5b677

@k8s-ci-robot k8s-ci-robot merged commit ffb4172 into kubernetes:master May 15, 2023
12 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v1.28 milestone May 15, 2023
@everpeace
Copy link
Contributor

everpeace commented May 19, 2023

@alculquicondor

This PR introduces a new config API in KubeSchedulerConfiguration that can provide a tradeoff between memory efficiency and scheduling speed when their leadership is updated in kube-scheduler. I think this PR should have a release note item. WDYT?

@alculquicondor
Copy link
Member

oh, that is correct. It's adding an API field, so it's user visible.

@linxiulei please add a release note.

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed release-note-none Denotes a PR that doesn't merit a release note. labels May 19, 2023
@linxiulei
Copy link
Contributor Author

Done. Thanks @everpeace & @alculquicondor

@alculquicondor
Copy link
Member

nit:

/release-note-edit

Added new config option `delayCacheUntilActive` to `KubeSchedulerConfiguration` that can provide a tradeoff between memory efficiency and scheduling speed when their leadership is updated in `kube-scheduler`

we use the yaml/json name in documentation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-review Categorizes an issue or PR as actively needing an API review. approved Indicates a PR has been approved by an approver from all required OWNERS files. area/code-generation cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
Status: API review completed, 1.28
Development

Successfully merging this pull request may close these issues.

Unexpected memory usage in follower kube-scheduler processes