[ 
https://issues.apache.org/jira/browse/YUNIKORN-3460?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Hedger Lai updated YUNIKORN-3460:
---------------------------------
    Summary: [Shim] Minimize victim pods in k8shim preemption by introducing 
reprieve verification  (was: Minimize victim pods in k8shim preemption by 
introducing reprieve verification)

> [Shim] Minimize victim pods in k8shim preemption by introducing reprieve 
> verification
> -------------------------------------------------------------------------------------
>
>                 Key: YUNIKORN-3460
>                 URL: https://issues.apache.org/jira/browse/YUNIKORN-3460
>             Project: Apache YuniKorn
>          Issue Type: Improvement
>          Components: shim - kubernetes
>            Reporter: Hedger Lai
>            Assignee: Hedger Lai
>            Priority: Major
>
> h3. Problem
> In k8shim, {{PreemptionFilter()}} removes candidate victim pods sequentially 
> starting from {{startIndex}}. Once filter plugins pass at index {{i}}, all 
> victims from index {{0}} to {{i}} are returned to Core and preempted. This 
> leads to over-preemption because earlier candidate pods that were not the 
> actual cause of predicate failures (e.g., {{PodAntiAffinity}}) are 
> unnecessarily evicted alongside the actual violator.
> h3. Root Cause
> Kubernetes {{kube-scheduler}} implements a two-phase preemption algorithm in 
> {{selectVictimsOnNode}}: a forward search phase followed by a reprieve phase 
> ({{reprievePod}}) that attempts to add back victims one by one to ensure only 
> the minimal required set is evicted.
> In YuniKorn, {{predicateManagerImpl.PreemptionFilter()}} only implements the 
> forward search phase:
> {code:go}
> for i := startIndex; i < len(victims); i++ {
>     p.removePodFromNodeNoFail(preemptingNode, victims[i])
>     status, _ := p.runFilterPlugins(ctx, *p.allocationFilters, cycleState, 
> pod, preemptingNode)
>     if status.IsSuccess() {
>         return i
>     }
> }
> {code}
> Furthermore, {{si.PreemptionPredicatesResponse}} only returns a scalar 
> {{Index int32}}, forcing Core to assume all victims in {{[0, Index]}} must be 
> preempted.
> h3. Fix
> 1. Extend {{si.PreemptionPredicatesResponse}} to optionally return {{repeated 
> string victimAllocationKeys}} (retaining {{Index}} for backward 
> compatibility).
> 2. In k8shim {{PreemptionFilter()}}, after predicates pass at index {{i}}, 
> introduce a reprieve pass to add back pods one by one. Pods whose restoration 
> still allows predicates to pass will be retained.
> 3. Return the minimal set of victim allocation keys to Core.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to