Skip to content

PodAutoscaler Pluggability and HPA #2196

Closed

Description

@josephburnett

Problem

Knative autoscaling should be pluggable at the bottom. Currently only the KPA is supported.

pluggable at the bottom

(source)

Proposal

Summary of work

  1. Expose metrics (concurrency and qps) from the queue-proxy in Prometheus format (Expose metrics from the queue-proxy #2202)
  2. Configure Prometheus to scrape pods for metrics (Autoscaler to scrape pods for metrics #2203)
  3. Update the KPA implementation to query Prometheus for average concurrency (60 and 6 second windows) -- removing the queue-proxy metrics push (Query Prometheus for average concurrency #2204)
  4. Make the Autoscaling reconciler only operate on PodAutoscalers with the autoscaling.knative.dev/class=kpa annotation (Have the KPA controller ignore explicitly annotated KPAs #1928)
  5. Implement a new, parallel Autoscaling reconciler which only operates on PodAutoscalers with the autoscaling.knative.dev/class=hpa annotation, stamping out HPA CRDs.

Architecture

20181009110458002_0001

Extensibility

Other reconcilers

To provide an alternative autoscaling implementation, an Operator should install a PodAutoscaler reconciler which handles the autoscaling.knative.dev/class=<other> annotation. The Namespace, Service, Configuration or Revision can be annotated with other and the default reconcilers will leave it alone.

Other metrics

To select between various metrics, Operators can provide the autoscaling.knative.dev/metric annotation with a value of concurrency, qps, cpu or custom.

autoscaling.knative.dev/metric=concurrency

Supported by the KPA and maybe the HPA. Supports the following annotations:

  • autoscaling.knative.dev/target to override the default target of 70% containerConcurrency.
autoscaling.knative.dev/metric=qps

Supported by the KPA and maybe the HPA. Supports the following annotations:

  • (required) autoscaling.knative.dev/target to select the target qps
autoscaling.knative.dev/metric=cpu

Supported by the HPA only. Supports the following annotations:

  • autoscaling.knative.dev/cpuUtilizationPercentage to override the default target
autoscaling.knative.dev/metric=custom

Supported by the HPA only. Supports the following annotations:

  • (required) autoscaling.knative.dev/metricPath to specify the path at which the application will export Prometheus metrics.
  • (required) autoscaling.knative.dev/metricName to specify the name of the metric to scale on.

Limitations

Scale-to-zero does not work with the Kubernetes HPA. TODO(josephburnett): figure out how to make this happen.

Activity

  1. added
    area/API
    kind/feature
    on Oct 9, 2018
  2. added this to the milestone on Oct 9, 2018
  3. lichuqiang commented on Oct 10, 2018

    @lichuqiang
    Contributor

    /cc

  4. erain commented on Oct 17, 2018

    @erain
    Contributor

    /cc

  5. removed
    area/API
    on Oct 31, 2018
  6. modified the milestones: , Serving "v1" (ready for production) on May 6, 2019
  7. mattmoor commented on Jun 18, 2019

    @mattmoor
    Contributor

    I'm ready to declare this done after @markusthoemmes latest PR, which adds e2e testing for using the HPA with concurrent request metrics.

    If nobody chimes in with what work remains, I'm inclined to close this out (and may close it out anyways if what remains is out of scope for "v1").

    cc @josephburnett @vagababov

  8. mattmoor commented on Jun 24, 2019

    @mattmoor
    Contributor

    @markusthoemmes mentioned one limitation we have today that I'd like to surface here, which is that the metrics collection is triggered by in-memory Metrics resources, so being able to truly plug in new autoscalers are limited to in-process. Correcting this is already tracked separately.

    I think that with the HPA testing we now have that I'm fairly happy with the model, and that what we have is probably sufficient to know that we won't require radical changes to the model to expand this beyond in-process.

    As we move to "v1" and beyond, I think we are going to want to replace our use of umbrella issues like this with Projects that collect the assorted issues that comprise them, and give us better visibility into their overall status.

    So I'm going to close this, and we can discuss pulling in any remaining issues that we want to be in scope.

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/feature

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions