Skip to content

Report the occupancy of a worker in ate.worker.state #1799

Closed

Description

@JeffLuoo

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

  1. added this to the M3 milestone on Sep 22, 2026
  2. added
    kind/design
    on Sep 22, 2026
  3. JeffLuoo commented on Sep 23, 2026

    @JeffLuoo
    CollaboratorAuthor

    Krisztian F (@krisztianfekete)

    any thought on this issue?

  4. krisztianfekete commented on Sep 24, 2026

    @krisztianfekete
    Collaborator

    Thanks Jeff Luo (@JeffLuoo), some notes:

    Report it as at_capacity??

    Capacity 0 is quite frequent and CreateWorker leaves capacity unset until ateom reports, so every new worker starts there, right? If we call it at_capacity, an HPA on at_capacity scales up on its own scale-up. idle is 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 the unknown sandbox class. Wdyt?

    Thus the metric no longer tells an operator how full a pool is.

    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.

  5. JeffLuoo commented on Sep 25, 2026

    @JeffLuoo
    CollaboratorAuthor

    #1854 implements this. ate.worker.state now 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area/observabilitykind/design

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions