Skip to content

KPA cannot scale gang workloads to zero #16684

Description

@yankay

/area autoscale
/kind bug

What version of Knative?

v1.23.0

Expected Behavior

KPA should support gang workloads whose valid replica states are:

replicas == 0, or replicas >= minCount

Actual Behavior

KPA gradually scales 2 -> 1 -> 0. With the default
MaxScaleDownRate=2:

Ready=2, metricDesired=0
desired=floor(2/2)=1

A gang workload with minCount=2 cannot realize one replica, so it remains at
two. KPA continues observing two Ready Pods and repeatedly requests one,
preventing scale-to-zero:

KPA requests 1 -> target remains at 2 -> repeat

Pods remain stable, but KPA desired remains 1, actual remains 2, and a
persistent write loop occurs. A control allowing one replica successfully
converges through 2 -> 1 -> 0.

Related behavior is discussed in #14017 and #15154.

KEDA avoids this using separate idle and active floors:

idleReplicaCount: 0
minReplicaCount: 2

https://keda.sh/docs/2.20/reference/scaledobject-spec/#idlereplicacount

This matters for gang-aware workload controllers, for example
ai-dynamo/grove#686, and Kubernetes Workload/PodGroup APIs in KEP-4671:

ai-dynamo/grove#686
https://github.com/kubernetes/enhancements/tree/master/keps/sig-scheduling/4671-gang-scheduling

Could KPA support a similar separation between idle and active floors?

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/autoscalekind/bugCategorizes issue or PR as related to a bug.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions