Skip to content

Use actual ready pods instead of observed pods for scaling rate #2994

Closed

Description

@yanweiguo

Expected Behavior

The scaling rate should be the ratio of desired pods versus actual ready pods, instead of observed pods. Observed pods includes lameducked pods, which are terminating.

When switching to scraping metrics, we can't get the correct observed pods if we sample. We have to use actual ready pods from K8S API anyway.

Actual Behavior

The scaling rate is the ratio of desired pods versus observed pods.

Activity

  1. added
    kind/bug
    kind/feature
    on Jan 25, 2019
  2. yanweiguo commented on Jan 25, 2019

    @yanweiguo
    ContributorAuthor
  3. markusthoemmes commented on Jan 25, 2019

    @markusthoemmes
    Contributor

    What do we need the scaling rate for in the end? Do we need it only for rate-limiting?

  4. yanweiguo commented on Jan 25, 2019

    @yanweiguo
    ContributorAuthor

    What do we need the scaling rate for in the end? Do we need it only for rate-limiting?

    According to my knowledge to current scaling algorithm, the answer is yes.

  5. yanweiguo commented on Jan 26, 2019

    @yanweiguo
    ContributorAuthor

    The formulas to calculate the desired pods are

    desired_pods = average_observed_revision_concurrency / target_concurrency_per_pod
        = observed_concurrency_per_pod * observed_pods / target_concurrency_per_pod
        = (observed_concurrency_per_pod / target_concurrency_per_pod) * observed_pods
    

    Let scaling_rate = observed_concurrency_per_pod / target_concurrency_per_pod, then

    desired_pods = scaling_rate * observed_pods
    

    Set a limitation for scaling rate, then

    limited_desired_pods = min(scaling_rate, max_scaling_rate) * observed_pods
    

    where observed_concurrency_per_pod and observed_pods are from stats data, target_concurrency_per_pod and max_scaling_rate are from configuration.

    However, the rate limiting should apply to actual current ready pod count. I propose:

    desired_pods = average_observed_revision_concurrency / target_concurrency_per_pod
    limited_desired_pods = min(desired_pods, actual_ready_pods * max_scaling_rate)
    

    where average_observed_revision_concurrency is from stats data, actual_ready_pods is from K8S API(informer), target_concurrency_per_pod and max_scaling_rate are from configuration.

    In this way, we can get rid of observed_pods and make the logical cleaner.

  6. added this to the Needs Triage milestone on Jan 28, 2019
  7. josephburnett commented on Jan 28, 2019

    @josephburnett
    Contributor

    What do we need the scaling rate for in the end? Do we need it only for rate-limiting?

    Yes. Just a safety heuristic.

    The scaling rate should be the ratio of desired pods versus actual ready pods, instead of observed pods. Observed pods includes lameducked pods, which are terminating.

    This was previously accounted for by degrading the contribution of lameducked pods. Is this no longer the case?

    I believe we also want this change for your scraping work, because we will never know the correct number of existing, ready pods by scraping if we sample. If so, that would be worth adding to the description.

  8. yanweiguo commented on Jan 28, 2019

    @yanweiguo
    ContributorAuthor

    I believe we also want this change for your scraping work, because we will never know the correct number of existing, ready pods by scraping if we sample. If so, that would be worth adding to the description.

    Yes. Updated the description.

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

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions