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

Store a cluster event to plugin map in SchedulerQueue #98241

Merged
merged 2 commits into from
Mar 4, 2021

Conversation

Huang-Wei
Copy link
Member

@Huang-Wei Huang-Wei commented Jan 20, 2021

What type of PR is this?

/kind feature
/sig scheduling

What this PR does / why we need it:

Part of #94009.

To determine whether a system event can move particular Pods from unschedulableQ/backOff to backoffQ/activeQ, this PR stores a cluster event -> unschedulable plugins in the scheduling queue. On the other hand, if a Pod failed the scheduling with a fitError (in PreFilter, Filter or Permit), we inject the failed plugins to PodInfo. With these 2 info combined together, we're able to move Pods in a fine-grained manner - which I will showcase in the next PR.

Which issue(s) this PR fixes:

The 2nd PR to #94009.

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/feature Categorizes issue or PR as related to a new feature. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. 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 Jan 20, 2021
@k8s-ci-robot
Copy link
Contributor

@Huang-Wei: 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 needs-priority Indicates a PR lacks a `priority/foo` label and requires one. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Jan 20, 2021
@Huang-Wei
Copy link
Member Author

/hold
to wait for #98041 to be merged first.

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 20, 2021
@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. area/e2e-test-framework Issues or PRs related to refactoring the kubernetes e2e test framework area/test sig/testing Categorizes an issue or PR as relevant to SIG Testing. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Jan 21, 2021
@Huang-Wei
Copy link
Member Author

The integration test seems related. I will take a look.

@Huang-Wei
Copy link
Member Author

The integration test seems related. I will take a look.

Oops, forgot to add StorageClass into the defaultClusterEvent list.

diff --git a/pkg/scheduler/framework/runtime/framework.go b/pkg/scheduler/framework/runtime/framework.go
index 74e97f33e56..d0500d77f9b 100644
--- a/pkg/scheduler/framework/runtime/framework.go
+++ b/pkg/scheduler/framework/runtime/framework.go
@@ -67,6 +67,7 @@ var defaultClusterEvents = []framework.ClusterEvent{
 	{Resource: framework.PersistentVolume, ActionType: framework.All},
 	{Resource: framework.PersistentVolumeClaim, ActionType: framework.All},
 	{Resource: framework.Service, ActionType: framework.All},
+	{Resource: framework.StorageClass, ActionType: framework.All},
 }
 
 var configDecoder = scheme.Codecs.UniversalDecoder()

Should be good now.

@Huang-Wei Huang-Wei force-pushed the sched-enqueue-2 branch 2 times, most recently from dea9959 to 31ecbb2 Compare January 21, 2021 05:40
@Huang-Wei
Copy link
Member Author

/retest

@Huang-Wei
Copy link
Member Author

/retest

@ahg-g
Copy link
Member

ahg-g commented Mar 2, 2021

There is clusterEvent, ok := clusterEventReg[event], which is not necessarily trivial. But maybe I'm being too paranoid.

the condition being checked is if len(pInfo.UnschedulablePlugins) != 0 && !p.podMatchesEvent(pInfo, event) {, in the baseline case, just fail the first condition so that podMatchesEvent doesn't even get executed. Basically make sure len(pInfo.UnschedulablePlugins) == 0 for the baseline case.

@Huang-Wei
Copy link
Member Author

which is not necessarily trivial. But maybe I'm being too paranoid.

@alculquicondor I ran a test to compare with the previous version. Which doesn't diff a lot.

⇒  benchstat baseline-without-this-PR.txt baseline.txt
name                                  old time/op  new time/op  delta
MoveAllToActiveOrBackoffQueue/1000-8   819µs ± 1%   830µs ± 1%  +1.36%  (p=0.000 n=20+20)
MoveAllToActiveOrBackoffQueue/5000-8  5.21ms ± 2%  5.43ms ± 3%  +4.18%  (p=0.000 n=20+18)

Basically make sure len(pInfo.UnschedulablePlugins) == 0 for the baseline case.

@ahg-g Code updated, and here is the latest testing result:

⇒  benchstat baseline.txt worst.txt
name                                  old time/op  new time/op  delta
MoveAllToActiveOrBackoffQueue/1000-8   830µs ± 1%  1153µs ± 2%  +38.90%  (p=0.000 n=20+19)
MoveAllToActiveOrBackoffQueue/5000-8  5.43ms ± 3%  7.35ms ± 4%  +35.44%  (p=0.000 n=18+20)

⇒  benchstat baseline.txt random.txt
name                                  old time/op  new time/op  delta
MoveAllToActiveOrBackoffQueue/1000-8   829µs ± 1%   494µs ± 2%  -40.42%  (p=0.000 n=18+19)
MoveAllToActiveOrBackoffQueue/5000-8  5.48ms ± 2%  3.28ms ± 2%  -40.20%  (p=0.000 n=19+19)

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.

It looks like, in the random case, skipping pod moves between queues heavily outweighs the event matching. LGTM

t.Run(tt.name, func(t *testing.T) {
got := make(map[framework.ClusterEvent]sets.String)
for _, p := range tt.plugins {
fillEventToPluginMap(p, got)
Copy link
Member

Choose a reason for hiding this comment

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

Test above looks good, we can remove this one.

@Huang-Wei
Copy link
Member Author

It looks like, in the random case, skipping pod moves between queues heavily outweighs the event matching. LGTM

Yes, and once the churn operator PR and the other 2 bug fixes get merged into integration perf test, I will build some integration benchmark tests, so that to get more practical performance results.

Test above looks good, we can remove this one.

Done. Commits squashed.

@alculquicondor
Copy link
Member

LGTM, but leaving official one to @ahg-g

And it looks like you have to deal with the upgrade to golang 1.16 :(

@ahg-g
Copy link
Member

ahg-g commented Mar 3, 2021

looks good, but there are still two commits in this PR.

@Huang-Wei
Copy link
Member Author

looks good, but there are still two commits in this PR.

Yes, it's intentional to leave the benchmark test as a separate commit.

And it looks like you have to deal with the upgrade to golang 1.16 :(

Hmm... Let me figure out the CI failure.

@alculquicondor
Copy link
Member

alculquicondor commented Mar 3, 2021

It's a known failure https://kubernetes.slack.com/archives/C2C40FMNF/p1614780753136400

@Huang-Wei
Copy link
Member Author

/retest

@ahg-g
Copy link
Member

ahg-g commented Mar 3, 2021

/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 Mar 3, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ahg-g, Huang-Wei

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

@Huang-Wei
Copy link
Member Author

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 3, 2021
@dims
Copy link
Member

dims commented Mar 4, 2021

/hold

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 4, 2021
@dims
Copy link
Member

dims commented Mar 4, 2021

/hold cancel
/retest

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 4, 2021
@Huang-Wei
Copy link
Member Author

/retest

@fejta-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to fejta).

Review the full test history for this PR.

Silence the bot with an /lgtm cancel or /hold comment for consistent failures.

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. area/e2e-test-framework Issues or PRs related to refactoring the kubernetes e2e test framework area/test cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. 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. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. release-note-none Denotes a PR that doesn't merit a release note. sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. sig/testing Categorizes an issue or PR as relevant to SIG Testing. 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.

7 participants