Scheduling policies

Configure how Pie orders requests, retains KV cache pages, and routes sessions across a cluster.

Pie separates scheduling and routing decisions into modular policies configured in config.toml. Policies decide which inferlet process runs next on a worker, which KV cache pages stay resident, and which worker handles an incoming session in a cluster.

cluster planewhich worker, which pages wherecache-awaresession-affinitydisaggregatereplicateworker planewhich process runs next, what stays cachedfairprioritydeadlinekeep-session
Cluster policies route sessions and place cache pages; worker policies order local processes.

Two policy planes

As the figure above shows, policies operate at two levels.

Worker policies run inside a single worker and order its local processes. Set one with [runtime] worker_policy:

PolicyBehavior
fairFair-share scheduling across clients using a virtual token counter (VTC).
priorityRuns processes with a higher priority property first.
deadlineEarliest-deadline-first (EDF) scheduling.
keep-sessionRetains a finished process's KV pages for a follow-up turn.
offloadSends prefill work to peer workers when local compute is busy.

Cluster policies run in pie-controller across all workers. List them in [cluster] cluster_policies:

PolicyBehavior
cache-awareRoutes a request to the worker that already holds its prompt prefix, unless that worker is overloaded.
session-affinityKeeps a multi-turn session on the same worker.
disaggregateSends prefill work to dedicated prefill workers.
replicate, pool-replicateCopies hot prefixes to additional workers or to a pie-pool.
persist-prefixKeeps hot prefixes on persistent disk across restarts.
drain-migrate, rebalance, relocateMoves active sessions and cache pages between workers.
cluster-priority, scale-by-prop, pin, retain-allCluster-wide priority ordering, autoscaling hints, worker pinning, and retention.

Sending SIGHUP reloads both worker and cluster policies without restarting the server.

Request hints (props)

Clients and inferlets can attach small typed key-value attributes called props to a process. Policies read those props when making decisions: for example, priority reads the integer priority prop, and keep-session reads keep-ms.