Repository navigation
Description
Problem
ate.worker.state is the only attribute of ate.workerpool.workers that shows how busy a worker is. It has two members, idle and assigned. A worker with 3 of 20 slots in use is neither, and ateapi reports it as assigned.
Thus the metric no longer tells an operator how full a pool is.
The work
1. Give the attribute three members instead of two.
Replace idle and assigned with idle, partial and at_capacity. A worker holds no actor, or it holds some actors and can take more, or it can take no more. A worker is always in exactly one of the three. Thus the counts still add up to the size of the pool, which is what the UpDownCounter contract needs.
Each member comes from a comparison of the allocated actor total against the actor capacity of the worker. No threshold is chosen, and no number lives in the code.
2. Change how ateapi picks the member.
ateapi asks "does this worker hold an actor" today. It must ask "how does the allocated total compare with the capacity". Zero is idle. Below the capacity is partial. At the capacity, or above it, is at_capacity.
3. [To discuss] Decide what to report for a worker with a capacity of zero.
CreateWorker does not check the capacity, so a worker can exist that offers no actor slots. Its allocated total is zero, so the rule above calls it idle. That is wrong for a reader: idle means warm capacity that is ready to take an actor, and the scheduler will never place an actor on this worker. A dashboard that adds the idle workers would count it as available.
Report it as at_capacity?? It has no room, which is true, and it is the answer that does not overstate the free capacity of the pool. ateapi already takes the same position for the sandbox class of such a worker.
4. Update the reference of the old values.
The two old values appear in the attribute constants of Substrate, in the unit tests of the metric, in the end-to-end metric test, and in the autoscaled-workerpool demo. The demo is the one that matters. See the discussion below.
Discussion: the demo autoscaler breaks
The autoscaled-workerpool demo drives a HorizontalPodAutoscaler from ate_workerpool_workers, filtered to the assigned state, with a 70% utilization target. Today assigned means "this worker is in use", so the average over the replicas is the utilization of the pool, and the HPA is correct.
After this change, we should update the HPA demo.
Activity
JeffLuoo commentedon Sep 23, 2026
Krisztian F (@krisztianfekete)
any thought on this issue?
krisztianfekete commentedon Sep 24, 2026
Thanks Jeff Luo (@JeffLuoo), some notes:
Capacity 0 is quite frequent and
CreateWorkerleaves capacity unset until ateom reports, so every new worker starts there, right? If we call itat_capacity, an HPA onat_capacityscales up on its own scale-up.idleis wrong too, as you said.Draining workers have the same problem today as if they are cached, the scheduler skips them, and we count them as
idle.I'd add a fourth state,
unschedulable, and let it win over occupancy. Every worker is still in exactly one state, so the sum is still the pool size. This matches what we already do with theunknownsandbox class. Wdyt?Three states don't fix this, though: 1/20 and 19/20 are both
partial. Worker counts can't give utilization, we need slot counts for that as mentioned on #1664.(ateapi): report worker occupancy by actor slots in ate.worker.state (a…
JeffLuoo commentedon Sep 25, 2026
#1854 implements this.
ate.worker.statenow has idle, partial, at_capacity, and unschedulable. For item 3, we used a fourth state, unschedulable, instead of at_capacity in the description. Pool utilization is not part of this issue. #1864 tracks it.