You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@yunikorn.apache.org by "Aditya Maheshwari (Jira)" <ji...@apache.org> on 2026/10/01 07:01:00 UTC

[jira] [Commented] (YUNIKORN-3403) Use cycle state in scheduler cache

    [ https://issues.apache.org/jira/browse/YUNIKORN-3403?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18121464#comment-18121464 ] 

Aditya Maheshwari commented on YUNIKORN-3403:
---------------------------------------------

h1. Why {{CycleState}} can't replace any part of {{SchedulerCache}} — in plain terms
h2. The core idea: two different kinds of memory

Think of the scheduler as having two kinds of memory:
 * *{{CycleState}} = a sticky note* for scheduling _one_ pod. You jot down some quick calculations while deciding where that single pod goes, and the moment it's placed, you throw the note away. Nobody else ever reads your note.

 * *{{SchedulerCache}} = the shared whiteboard* for the whole cluster. It tracks every node, every pod, and what's happening right now. Everyone reads it, and it stays up even after any single pod is scheduled.

A sticky note can never replace the whiteboard, because they answer different questions: _"what am I calculating for this one pod?"_ versus _"what does the whole cluster look like?"_
h2. Walking through each piece

*The affinity node lists* ({{{}nodesInfoPodsWithAffinity{}}}, {{{}nodesInfoPodsWithReqAntiAffinity{}}})
These answer _"which nodes in the cluster already have pods with affinity rules?"_ That's a fact about the {*}whole cluster{*}, and it's the *same answer no matter which pod* you're currently placing. Putting it on a per-pod sticky note would be wrong (it's not about one pod) and wasteful — you'd rebuild the entire list from scratch for every single pod, which is the opposite of caching. It belongs on the shared whiteboard.

*Assumed pods* ({{{}assumedPods{}}})
This remembers _"I've decided where this pod goes, but the cluster hasn't officially confirmed it yet."_ Two reasons a sticky note can't hold this:
 * *It has to outlive the decision.* The sticky note gets thrown away the instant the pod is placed — but we need to _keep_ remembering the pod is "pending confirmation" for a while afterward, across many later scheduling rounds.
 * *Everyone else needs to see it.* When placing the _next_ pod, the scheduler must know this earlier pod is already taking up space. A private sticky note is invisible to everyone else, so that space would get double-booked.

*Everything else* (nodes, pods, priority classes, assigned pods, orphaned pods, PVC counts)
These are all living records of the actual cluster state. They're updated by outside events (pods and nodes coming and going) that have nothing to do with any single scheduling cycle. A sticky note that gets torn up after one pod simply can't track an ever-changing cluster.
h2. The one thing that _is_ a sticky note

{{podsCycleState}} *is* the sticky note — it literally stores {{{}CycleState{}}}. But it still needs the surrounding map because of how YuniKorn is built: the "write the note" step and the "read the note" step happen as *two separate messages* between YuniKorn's core and the Kubernetes shim, instead of one continuous function. So the note has to be filed away (labeled by pod) in between, rather than just held in hand.
h2. Bottom line
{quote}{{CycleState}} is *short-lived and private* (one pod, then gone). Everything in {{SchedulerCache}} is either *long-lived* (survives past one pod) or *shared* (other pods and other parts of the system depend on it) — usually both. That mismatch is exactly why {{CycleState}} can't make any of it redundant.
{quote}

> Use cycle state in scheduler cache
> ----------------------------------
>
>                 Key: YUNIKORN-3403
>                 URL: https://issues.apache.org/jira/browse/YUNIKORN-3403
>             Project: Apache YuniKorn
>          Issue Type: Improvement
>          Components: shim - kubernetes
>            Reporter: Manikandan R
>            Assignee: Aditya Maheshwari
>            Priority: Major
>
> Now that K8s internal cycle state has been adopted from https://issues.apache.org/jira/browse/YUNIKORN-3300, need to revisit entries in Schedular Cache to see whether those can be used directly from state itself rather than persisting explicitly and using it.
> State should have been populated during PreFilter and Filter stage itself for all registered Plugins with info specific to its operation.
>  
>  



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

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@yunikorn.apache.org
For additional commands, e-mail: issues-help@yunikorn.apache.org