Endpoints
Autoscaling
Scale each endpoint on in-flight requests, queue, KV pressure and time to first token; sleep engines, scale to zero, grow onto other vendors, and hand scaling to KEDA.
Each endpoint scales by its own plan.autoscale. The control plane reads each leader's /loadz every 10 s and adds or parks workers (or whole gangs) inside floor and max. With max: 0 the endpoint's size is fixed: the planner then writes floor and max as the number of workers the plan runs.
autoscale:
floor: 1 # minimum workers; 0 = may scale to zero
max: 4 # maximum; 0 = autoscaling off
unit: workers # workers | gangs
targetInflight: 2 # in-flight requests one worker carries before another is added
idleSeconds: 120 # demand below the current size this long parks one worker
kvPressurePct: 85 # grow when the busiest worker's KV cache reaches this percent
ttftBudgetMs: 0 # grow when the leader's p95 time to first token is above this; 0 = none
sleepSeconds: 0 # idle seconds before the engine sleeps (vLLM); 0 = no sleep tier
sleepCard: keep # keep | free, for shared plans with a sleep tier
scaleIn: drain # drain | now
drainSeconds: 120 # how long a stopping worker may finish its requests
wakeSloMs: 0 # advisory wake target for the stats; gates nothing
grantHeadroom: 1 # workers reserved beyond what runs, for an external scalerPaid GPUs vs. the GPUs traffic needs, over one day
Illustrative model, not a measurement · 16-GPU reservation
In short
Autoscaling adds a worker when an endpoint is busy and parks one when it is quiet, always between floor and max. The control plane reads the leader's load every 10 s and decides. With floor: 0 an idle endpoint frees its GPUs, and the next request wakes it. With max: 0 the endpoint keeps a fixed size.
When you need it
- Traffic changes through the day, and you do not want to hold GPUs for the peak all the time.
- A test or batch endpoint is idle for hours: let it scale to zero.
- Requests queue, or time to first token is too long, at busy moments.
- You want scaling to keep working while the control plane is down: hand it to KEDA.
Do it
Choose the bounds
This example keeps one worker, grows to four, and parks a worker after 5 minutes of low demand:
autoscale: { floor: 1, max: 4, unit: workers, targetInflight: 4, idleSeconds: 300 }Write it into the plan
curl -s -H "$H" https://cp.example.com/api/v1/endpoints/<id>/plan \ | jq '.autoscale += {floor: 1, max: 4, unit: "workers", targetInflight: 4, idleSeconds: 300}' > new.json curl -s -H "$H" -H 'Content-Type: application/json' -X PUT \ https://cp.example.com/api/v1/endpoints/<id>/plan -d @new.json | jq .autoscaleFrom 0.3.0 the CLI changes only the fields you name:
opodcp endpoint autoscale --floor 1 --max 4 --target-inflight 4 --idle 300 chatDrive some load
Send more requests at once than
floor × targetInflightfor a minute, for example with your load tool or theautoscaleblock of a scenario (Create → From the CLI).Watch it decide
watch -n 10 "curl -s -H '$H' https://cp.example.com/api/v1/endpoints/<id>/status | jq -c '{phase, counts, scaling}'"
Check it worked
A good answer: scaling.by is embedded (or keda), counts.ready rises above floor under load, and it falls back one worker at a time after idleSeconds of quiet. scaling.ceiling says the most the endpoint can reach now. In the console, the Autoscale page shows each endpoint's owner, bounds and current size.
curl -s -H "$H" https://cp.example.com/api/v1/endpoints/<id>/autoscale/stats | jq '{wakes, lastWakeMs, savedGpuHours}'If it fails
| Symptom or code | Cause | Fix |
|---|---|---|
| It never grows past one worker | demand stays under targetInflight per worker, or max is 0 | a lower targetInflight, or a max above floor |
scaling.ceiling is below max; alert autoscale.no-capacity | the ledger, the licence or the team quota has no room for the next worker | free a card, raise the quota, or a larger licence; read scaling.blocked |
E-KV-SIGNAL | a KV trigger on an engine that reports no KV pressure | kvPressurePct: 0 |
E-TTFT-SIGNAL | a TTFT budget on an embeddings or rerank endpoint, or a leader without the measurement | ttftBudgetMs: 0 |
E-SLEEP-CARD | sleepCard: free on a dedicated plan | keep, or a shared plan |
E-PARK-FLOOR | parked gangs would leave fewer serving than floor | lower floor, or wake a gang |
E-SCALER-ROWS (KEDA) | several worker rows; KEDA drives one template | one row, or autoscaler.adapter=embedded |
E-GROWTH-ENGINE | a growth shape's vendor has no image for the engine | another vendor, or drop that shape |
| The first request after zero takes a long time | a wake from zero starts a pod and loads the model | a sleep tier (sleepSeconds, vLLM on NVIDIA), or floor: 1 |
Fields
| Field | Default | Range and rule |
|---|---|---|
floor, max | fixed size | 0 or more; floor at most max |
unit | workers | workers or gangs; gangs needs shardGroups |
targetInflight | 2 | in-flight requests per worker |
idleSeconds | 120 | seconds of low demand before one worker parks |
kvPressurePct | 85 | 0 (off) to 100. Written only for an engine that reports KV pressure (vLLM, SGLang, llama.cpp as slot occupancy) and not on llama.cpp workers that share one KV pool |
ttftBudgetMs | 0 | 0 (none) or 50 to 600,000 |
sleepSeconds | 0 | 0 or more; a sleep tier needs vLLM and unit: workers |
sleepCard | keep | keep or free; free needs a sleep tier and a shared plan. New in 0.3.0 |
scaleIn | drain | drain or now; now with drainSeconds is refused. New in 0.3.0 |
drainSeconds | 120 | 0 (the default) to 3600. New in 0.3.0 |
growth[] | none | ordered growth shapes (below). New in 0.3.0 |
wakeSloMs | 0 | 0 (no target) to 3,600,000; advisory |
grantHeadroom | 1 | workers reserved beyond what runs, under KEDA |
granted[], reserved | set by the server | the capacity reserved for an external scaler (node, gpu per slot); never taken from a caller |
A remote endpoint takes no autoscale (autoscale.max above 0 is refused).
When it grows and shrinks
It grows by one worker when any of these holds:
- in-flight requests exceed
targetInflightper worker; - the leader's queue is not empty (every slot is busy);
- the busiest worker's KV cache is at or above
kvPressurePct; - the leader's time-to-first-token p95 over the last minute is above
ttftBudgetMs(streamed answers only).
Any traffic in the last minute holds at least one worker. With the endpoint at zero, a request the leader refused in the last minute is demand, so the endpoint wakes. A worker whose engine is dead is asked for again on top of the demand. Growth from a serving size waits 30 s after the last grow, so one burst does not climb straight to max; a wake from zero does not wait.
It shrinks one worker at a time once demand has stayed below the current size for idleSeconds, then waits a full window again before the next step. A non-empty queue, a KV cache at or above half of kvPressurePct (85 when unset), a dead engine, or a breached TTFT budget holds off a shrink. A TTFT budget may only add workers, never remove them. A prefill/decode endpoint grows and shrinks by a whole pair.
Refused by name where a trigger could never fire: E-KV-SIGNAL (a KV trigger on an engine with no KV signal), E-TTFT-SIGNAL (a TTFT budget on embeddings or rerank, which never stream, or on a leader without the measurement). unit: gangs with max above 1, or several active gangs, needs a leader that advertises shard_groups.
The autoscaler, minute by minute
Workers it runs against the workers the traffic asks for · 20 simulated minutes
Tiers of idle
| Tier | What happens | Wake |
|---|---|---|
| Sleep | the last awake worker's engine sleeps after sleepSeconds; its pod and ledger claim stay. vLLM on NVIDIA only. | sub-second |
| Pod-zero | with floor: 0, the last worker's pod is parked after idleSeconds more; weights stay cached on the node | a pod start and a model load |
| Node-zero (opt-in) | with cloud.nodeScaling=true, an endpoint that KEDA owns, held at its ceiling by a full fleet while its load wants more, asks the node autoscaler for one more GPU node of its vendor through a Pending request pod | a node, then a pod |
The node-zero tier runs only for endpoints KEDA owns: the request is made where the capacity grant is refreshed, and the embedded loop has no grant. It is built and tested, and not yet proven against a real node provisioner. It is off by default: on bare metal nothing answers, and a Pending pod nobody explains is worse than an endpoint that says it is at its ceiling. In 0.3.0 a fixed-size plan with a sleep tier also sleeps.
Requests during a wake are held, not refused. A plan with floor: 0 runs with the leader's admission hold raised to 60 s, so a client waits through the wake instead of getting a 503; Preview says so with a wake-hold advisory. A request for a sleepCard: free sleeper that must wake on another card waits up to 3 minutes. Both holds are new in 0.3.0.
sleepCard: free (shared plans with a sleep tier) releases the card's claim while the engine sleeps, so another endpoint may place there. The wake claims it again, or, when it was taken, parks the worker and wakes one on another card. A dedicated plan is refused E-SLEEP-CARD. The default, keep, keeps the sub-second wake.
scaleIn: drain (default) lets a stopping worker finish the requests it is serving: it takes no new request and stops its engine when nothing is in flight or drainSeconds pass. Its pod's grace period is 30 s longer. now stops at once and cuts every stream on it. It applies to every stop of a worker: a scale-in, a rolling update, a deleted pod. It needs a worker image with core's worker_drain feature; an older one stops at once.
Growing onto other hardware
Growth shapes are new in 0.3.0 (what is proven per vendor: Mixed GPU vendors). autoscale.growth is an ordered list of shapes the loop grows in. The first shape that places wins; a scale-in parks the last shape's workers first and your own rows last.
autoscale:
floor: 1
max: 8
growth:
- { name: nvidia-extra, vendor: nvidia, max: 4 }
- { name: amd-overflow, vendor: amd, max: 4, vramBudgetGb: 20, flags: { max_model_len: "8192" } }| Shape field | Meaning |
|---|---|
vendor | required: the vendor this shape grows on |
name | a label on events and on each worker it grew; default the vendor; unique in the list |
max | workers grown on this shape; 0 = up to autoscale.max |
vramBudgetGb | the budget per worker; 0 = the template's |
flags | laid over the template's flags, key by key |
parallelism | replaces the template's when set |
image | an image for this vendor; default the cell's image for the engine and vendor. A gang shape names none |
Each shape is the template worker (the first active row) with what it names laid over it. Each is judged when the plan is written, as a one-worker plan on its vendor's largest card: a vendor where the engine has no image is E-GROWTH-ENGINE, a shared shape off NVIDIA is E-SHARED-VENDOR, and a vendor with no node yet draws the advisory growth-no-node. Growth is refused with autoscaling off, on a prefill/decode endpoint, and on a gang plan whose unit is not gangs. Under unit: gangs, a shape is laid over the template gang and its parts are placed on the shape's vendor.
When growth finds only a preemptible job's card, it evicts that job. In 0.3.0 a grow, a create or a rollout evicts only the jobs whose cards it takes, and a node that already holds the weights is chosen first.
- From 0.3.2 waking a parked gang and growing a prefill/decode pair evict a preemptible job on the cards they need, too. In 0.3.0 they hold instead.
- On a KEDA-owned endpoint too (
autoscaler.adapter: keda, a worker plan withmaxabovefloorand no growth shapes; from 0.3.2). The capacity grant may reserve a card a preemptible job holds when no free card is left; the reservation alone evicts nothing. When KEDA adds a replica and no node takes it, the control plane evicts the job on its granted card within one autoscale pass, and the pod lands. On 0.3.0 the pod waitsPendingbehind the job: give the plan a growth shape (autoscale.growth: [{vendor: nvidia}]) so the control plane's loop scales it.
Gangs
Under unit: gangs a gang parks and wakes as a unit; gangs have no sleep tier. In 0.3.0, with every gang awake and max 2 or more, the loop adds a placed copy of the first gang under a new id, on that gang's vendor, and parks the last gang first when idle. Up to 0.3.6 the embedded loop grew a gang only on in-flight requests and the TTFT budget. From the release after 0.3.6 it also reads a gang's queue and KV cache, which the leader takes from the gang's coordinator (core's gang_load): a queue, or the busiest gang's cache at or above kvPressurePct, adds one gang, and a cache above half of it holds a park. A dead part does not ask for another gang. A plan whose parked gangs leave fewer serving than its floor is refused E-PARK-FLOOR. A gang whose leader gave up forming it (gaveUp) is never woken.
The embedded loop or KEDA
autoscaler.adapter chooses who moves an endpoint's replicas. The choice is per install, and ownership is per endpoint: with keda on, an endpoint KEDA cannot drive stays on the embedded loop in the same cluster, and its scaling.by says so.
| Aspect | embedded (default) | keda |
|---|---|---|
| Who moves replicas | the control plane's own loop | KEDA's operator and a HorizontalPodAutoscaler, through one ScaledObject per endpoint |
| What it moves | the plan: worker rows, gangs, sleep marks | the replica count of one worker Deployment, or the group count of one gang's LeaderWorkerSet. The control plane never sends replicas for it |
| Signals | the leader's /loadz every 10 s: in-flight, queue, KV pressure, TTFT p95 | the same /loadz, read by KEDA's metrics-api trigger every 10 s: in_flight against targetInflight, queue_depth against 1 per worker, kv_busy_workers against kvPressurePct (only for an engine that reports KV), ttft_p95_ms against ttftBudgetMs (only when set), and unavailable_1m and rpm_1m to wake and to hold one worker |
| How fast it grows | one worker at a time, 30 s after the last grow | in proportion to the load, up to double every 15 s |
| How fast it shrinks | one worker per idleSeconds of low demand | one pod a minute, after a 300 s stabilisation window; the last worker after idleSeconds (cooldownPeriod) |
| Wake from zero | a request the leader refused in the last minute | the same count (unavailable_1m), through KEDA's activation |
| During a control-plane outage | the size freezes. Running workers keep serving; an endpoint parked at zero stays parked and its requests get 503 once the leader's hold runs out | scale-out, scale-in and wake from zero keep working, inside the reservation that was in place when the control plane went away |
| Needs on the cluster | nothing | KEDA (substrate.keda.enabled=true, or your own) and a serving external-metrics API |
| Capacity | each grow is judged against the ledger, licence and quota when it happens | reserved in advance in plan.autoscale.granted (below) |
Node-zero tier (cloud.nodeScaling) | no | yes |
| Endpoints it can own | every plan that autoscales | the classes in the next list |
What KEDA can own. Exactly these, and only with max above floor and no sleep tier:
- dedicated workers in one worker row (
unit: workers); - a shared plan of one budgeted row on a named card, when that card holds every replica's budget up to
max(autoscale.reserved: true); - one gang that landed as one LeaderWorkerSet (
unit: gangs), parked and woken:max: 1. In 0.3.6 KEDA also took a gang withmax2 or more, but its second gang was a copy pinned to the first gang's machines, so it waitedPendingfor ever while other cards sat idle. From the release after 0.3.6, such a gang stays on the embedded loop, which places each new gang on machines of its own.
What stays on the embedded loop, per endpoint, with the reason in scaling.detail: any other shared plan, the sleep tier, several gangs, one gang that may grow past one (max 2 or more; the release after 0.3.6), a gang that landed one Deployment per part (no LeaderWorkerSet controller, or parts on different vendors), plans with growth shapes (0.3.0), and remote endpoints. A fixed-size plan is scaled by nobody (scaling.by: off). Refused under keda: E-SCALER-ROWS (several worker rows: KEDA drives one template), E-SCALER-PD (a prefill/decode plan; 0.3.0).
How capacity is reserved for KEDA
KEDA never reads the ledger, the licence or the team quota, so the control plane decides the bounds in advance and writes them into objects KEDA and Kubernetes already obey:
- The grant. On every pass, the control plane walks the placer for the endpoint, as it would for a grow, and stores the result in
plan.autoscale.granted: one{node, gpu}slot per worker. The slots are what runs, plusgrantHeadroommore (default 1), never more thanmax. The next slot goes on another machine before it doubles up on one. - The bounds.
maxReplicaCountis the number of slots, and a node labelopod.io/grant-<id>on each approved node pins the replicas there. So KEDA can never start a worker on capacity nobody approved. Each step it takes runs a worker, which moves the grant up on the next pass, so it can still reachmax. - Who counts it. The ledger and the team quota count every slot: no other endpoint may place there. The licence counts only the slots with a worker running, so unused headroom does not spend the free tier.
- Give-back. Headroom that stays unused for two hours is given back to the ledger, and taken again when the endpoint uses what it has. When the endpoint leaves the classes KEDA can own (you set a sleep tier, add a row, or switch the adapter back), the whole grant is released.
- A grant below the floor. The grant wins: KEDA's minimum is lowered to the grant, and the alert
autoscale.grant-below-floornames the endpoint, the floor and the grant. - A shared row. Its grant is every replica up to
maxon its one card, with no headroom rule, because a replica of that row can only land on that card.
What an outage still stops
With every control-plane replica down, KEDA keeps scaling inside the grant that was stored last. Nothing else moves: no new grant, no new capacity, no plan edit, no rollout, and no embedded-loop endpoint changes size. KEDA is then the part that must stay up. If its operator stops, nothing grows and an endpoint parked at zero does not wake; if the cluster's external-metrics API stops serving, no trigger can be read and nothing scales. Running workers keep serving in both cases. A stopped operator still reports its ScaledObjects Ready, so the control plane reads the lease the operator renews instead: scaling.ready reads stale for a stopped operator, no-metrics for the metrics API, and absent or false for a missing or unready ScaledObject. Any value but true raises the alert autoscale.scaler-unhealthy, which the control plane can only raise while it runs.
Which should I pick
- Keep
embeddedwhen the cluster cannot run KEDA, or when most endpoints use the sleep tier, shared cards, several gangs or growth shapes. KEDA would own none of them. - Pick
kedawhen an endpoint atfloor: 0must wake, or a busy endpoint must grow, while the control plane is down (an upgrade, a lost node, a database outage). That is the one thing only KEDA gives. - Pick
kedafor dedicated single-row endpoints with fast-changing load. It answers a burst in proportion to its size, where the embedded loop adds one worker per 30 s. - Stay on
embeddedwhen you cannot spare a held card: under KEDA each owned endpoint keepsgrantHeadroomcards (or budgets) reserved beside what runs.grantHeadroom: 1is the smallest reservation. - Mixed installs are normal. Turn
kedaon, and readscaling.byon each endpoint: the ones KEDA cannot own stay on the embedded loop and say why.
helm upgrade opodcp … --reset-then-reuse-values --set autoscaler.adapter=keda --set substrate.keda.enabled=true
opodcp doctor # the autoscaler row: "keda connected", or what is missingsubstrate.keda.enabled installs KEDA as a chart dependency, in the release namespace, with its Secret access restricted to that namespace. Leave it off when the cluster already runs KEDA. Toggle it once: turning it off later removes KEDA's CRDs and every ScaledObject. Before 0.3.0, substrate.keda.enabled and cloud.nodeScaling did not take effect.
What it is doing
Each endpoint's status carries scaling:
{ "by": "keda", "ceiling": 3, "max": 4, "ready": "true", "detail": "…why this owner and this ceiling…",
"blocked": { "reason": "…why the next worker cannot be placed…", "since": "…" } }by is embedded, keda or off. ceiling is the plan's max lowered to what the ledger, the licence and the quota allow. A grow that cannot be placed raises the alert autoscale.no-capacity after a minute. In 0.3.0 it is also blocked, and a line on the endpoint page. A grow that was given back holds growth for a while, and the hold says until when.
GET /api/v1/endpoints/{id}/autoscale/stats?since=<RFC 3339> (default: the last 30 days) says what parking saved and what the last wake cost:
{ "endpoint": "chat", "since": "…", "until": "…", "gpuHours": 41.2, "savedGpuHours": 30.5, "savedBasis": "…",
"parkedSeconds": 109800, "awakeSeconds": 148320, "wakes": 12, "lastWakeAt": "…", "lastWakeMs": 54000,
"wakeSloMs": 60000, "wakesInSlo": 11, "attainment": 0.92 }savedGpuHours is absent when the endpoint has no measured footprint. pendingWake is true when a wake has not yet proven a token. Attainment appears only when you set wakeSloMs; it gates nothing.
From the CLI
The opodcp endpoint commands are new in 0.3.0.
opodcp endpoint autoscale chat # print the policy, who scales it, why it is held
opodcp endpoint autoscale --floor 0 --max 4 --sleep 300 chat # change only those fields
opodcp endpoint autoscale --scale-in drain --drain 60 chat
opodcp endpoint autoscale --growth-file shapes.yaml chatFlags: --floor, --max, --unit, --target-inflight, --idle, --kv-pressure, --sleep, --sleep-card, --ttft-budget, --wake-slo, --grant-headroom, --scale-in, --drain, --growth-file. The console's Autoscale page and the endpoint page's Edit policy set the same fields.
Last updated · Source: content/docs/control-plane-endpoints/autoscaling.mdx · View as Markdown