-
Notifications
You must be signed in to change notification settings - Fork 40k
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
-Add scheduler optimization options, short circuit all predicates if … #56926
Conversation
/assign @davidopp @jayunit100 |
/ok-to-test |
/test pull-kubernetes-unit |
The test failed, I think I might need help when I short circuit all predicates if one predicate fails, what else do I need. |
/retest |
how can i fix it?
|
/cc @kubernetes/sig-scheduling-pr-reviews |
pkg/apis/componentconfig/types.go
Outdated
@@ -111,6 +111,9 @@ type KubeSchedulerConfiguration struct { | |||
// Indicate the "all topologies" set for empty topologyKey when it's used for PreferredDuringScheduling pod anti-affinity. | |||
// DEPRECATED: This is no longer used. | |||
FailureDomains string | |||
|
|||
// EnablePodFitsOnNodeOptimization enables shorting circuit all predicates if one predicate fails | |||
EnablePodFitsOnNodeOptimization bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bad name ... should be more specific like QuickFailPredicate
or something else
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need an option for this. This should be default behavior in my opinion. It doesn't make sense to check all other predicates when one fails. We are adding the logic to order predicates and default ordering is to run predicates with lower overhead first. The whole ordering of predicates makes sense only if we stop checking predicates when one fails. Otherwise, the ordering is not useful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UPDATE: reading another thread, we may actually need a flag for those customers who want to find what are all the predicates that have failed for a node. So, let's rename this flag to something like AlwaysCheckAllPredicates
. Default value should be false. Please add a comment in front of the flag to mention that enabling this option may hurt scheduler performance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Totally agree this should put predicate ordering into consideration.
cc @wgliang It's https://github.com/kubernetes/community/pull/1152/files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, it's my fault I should say that put predicate ordering will improve performance even more. In fact, we have already sorted out our own scheduler, for example, we will calculate the smaller number of CPU cores, memory size in front of the complex information such as disk and network. In this way, the implementation of the previous failure, to avoid later more complex calculations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@resouer You are right, I will rename it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 for default behaviour setting AlwaysCheckAllPredicates
to false.
This is related to what @bsalamat discussed recently. But I am not very sure if an extra option is the solution ... or, fast fail should be default behavior at least . WDYT bobby? |
@resouer Instead of modifying current default behavior, I wanted to add a higher-performance option, albeit losing some failure information. |
@@ -917,7 +923,7 @@ func selectVictimsOnNode( | |||
violatingVictims, nonViolatingVictims := filterPodsWithPDBViolation(potentialVictims.Items, pdbs) | |||
reprievePod := func(p *v1.Pod) bool { | |||
addPod(p) | |||
fits, _, _ := podFitsOnNode(pod, meta, nodeInfoCopy, fitPredicates, nil, queue) | |||
fits, _, _ := podFitsOnNode(pod, meta, nodeInfoCopy, fitPredicates, nil, queue, false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should it be true
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It has been modified.
/retest |
Who can help me solve the problem or tell me the reason of test failure? |
/retest |
@@ -474,6 +475,11 @@ func podFitsOnNode( | |||
if !fit { | |||
// eCache is available and valid, and predicates result is unfit, record the fail reasons | |||
failedPredicates = append(failedPredicates, reasons...) | |||
// since alwaysCheckAllPredicates has not been set, the predicate evaluation is short | |||
// circuited and there are chances of other predicates failing as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I wanted this to be logged using glog.V(5) or higher not as a comment in the code, the reason being debugging becomes easy when someone is going through scheduler logs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As for each node will be implemented here, so there will be a lot of log information is printed out, are you sure it is friendly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think thats a trade-off that we will have but putting logging at highest level might reduce the impact.
@wgliang - can you add your release-note between `` ? |
@@ -377,6 +378,17 @@ func TestGenericScheduler(t *testing.T) { | |||
expectsErr: true, | |||
wErr: fmt.Errorf("persistentvolumeclaim \"existingPVC\" is being deleted"), | |||
}, | |||
{ | |||
// alwaysCheckAllPredicates is true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, but this is not useful. You should probably add a couple of predicates and create a pod that fails all predicates and then check that all of the predicates are exercised when alwaysCheckAllPredicates
is true.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bsalamat Thank you very much for your guidance, I have already done it.
/test pull-kubernetes-unit |
I'm ready. |
/lgtm Thanks, @wgliang! |
/assign [@brendandburns @eparis @thockin @zmerlynn] |
/approve |
…one predicate fails
@bsalamat There has been a conflict commit, has been rebase. Please help delete do-not-merge label and merge PR. Thanks! |
/lgtm |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: bsalamat, k82cn, ravisantoshgudimetla, thockin, wgliang Associated issue: #56889 The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
/test all [submit-queue is verifying that this PR is safe to merge] |
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions here. |
…one predicate fails
Signed-off-by: Wang Guoliang iamwgliang@gmail.com
What this PR does / why we need it:
Short circuit all predicates if one predicate fails.
I think we can add a switch to control it, maybe some scenes do not need to know all the causes of failure, but also can get a great performance improvement; if you need to fully understand the reasons for the failure, and accept the current performance requirements, can maintain the current logic. It should expose this switch to the user.
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #56889 and #48186
Special notes for your reviewer:
@davidopp
Release note: