Find reference information about the parameters that you set to configure Tanzu Service Mesh Service Autoscaler. Also find reference information about the metrics you can use with the autoscaler.

You can set Tanzu Service Mesh Service Autoscaler parameters using a Kubernetes Custom Resource. The following example shows a custom resource and explains the possible configuration properties that you apply to an onboarded cluster. The kind as defined in the Custom Resource Definition (CRD) for this autoscaler is Definition or asd for short under the autoscaling.tsm.tanzu.vmware.com/v1alpha1 API group.

You can configure Tanzu Service Mesh Service Autoscaler through the Definition custom resource manifest file. Shown here is frontend-asd.yaml, an example Definition custom resource manifest for a single microservice. The spec section of this example contains all the possible configuration properties unique to the autoscaler.

apiVersion: autoscaling.tsm.tanzu.vmware.com/v1alpha1
kind: Definition
metadata:
  name: frontend-asd
  namespace: acme
  labels: 
    app: frontend
spec:
  scaleTargetRef:
    kubernetes:
      apiVersion: apps/v1
      kind: Deployment
      name: frontend
  scaleRule:
    mode: EFFICIENCY
    enabled: true
    instances:
      min: 1
      max: 10
      default: 5
      stepsDown: 2
      stepsUp: 3
    trigger:
      gracePeriodSeconds: 300
      metric:
        name: CPUUsageMillicores
        scaleUp: 500
        scaleDown: 100
        windowSeconds: 600 

Every property in the spec section of the Definition custom resource is a configuration unique to the Tanzu Service Mesh Service Autoscaler. The following table describes the configurable properties in the spec section of the custom resource. The table also includes a few fields from the metadata section and explains their values.

Table 1. Tanzu Service Mesh Service Autoscaler configuration properties (CRD)

Custom Resource Property

Required/Optional

Description

metadata.name

Optional

Name of this custom resource.

metadata.namespace

Optional

When the custom resource is applied, it will be on the namespace specified here.

metadata.labels

Optional

Labels can be used to organize and select subsets of objects.

spec.scaleTargetRef.kubernetes.kind

Required

Describes the Kubernetes resource that is being adjusted. Options: Deployment, ReplicaSet, or StatefulSet.

spec.scaleTargetRef.kubernetes.name

Required

Name of the Kubernetes resource being scaled within the same namespace.

Important:

Ensure that there is only one autoscaling definition per service with this scaleTargetRef.kubernetes.name. For more information, see the spec.scaleTargetRef.kubernetes section in Tanzu Service Mesh Autoscaler Configuration Details.

spec.scaleTargetRef.kubernetes.apiVersion

Optional

API version for the Kubernetes resource, for example, apps/v1 for the deployment resource set in spec.scaleTargetRef.kubernetes.kind.

spec.scaleRule.mode

Required

Determines if services will be scaling up only (performance) or scaling up and down (efficiency). Options: EFFICIENCY or PERFORMANCE.

spec.scaleRule.enabled

Required

Determines if the autoscaler will change the number of running service instances. Options: true, false.

If true, scaling occurs. If false, the scaling doesn’t occur, but the desired number of replicas will be displayed. This is a way to do a dry run and observe autoscaler behavior.

spec.scaleRule.instances.min

Required

The minimum number of service instances that the autoscaler is allowed to set. Must be an integer between 1 and 1000, inclusive.

spec.scaleRule.instances.max

Required

The maximum number of service instances that the autoscaler is allowed to set. Must be an integer between 1 and 1000, inclusive.

spec.scaleRule.instances.stepsDown

Optional

Scale instances based on the steps is set here. If stepsUp is set, also set stepsDown. If neither is set, proportional scaling is used.

spec.scaleRule.instances.stepsUp

Optional

Scale instances based on the steps to scale down set here. If stepsDown is set, also set stepsUp. If neither is set, proportional scaling is used.

spec.scaleRule.instances.default

Optional

The default instance number is used when the autoscaler has insufficient information on the service instances running. In such a case, if the current number of instances is less than the default number of instances, scaling up is triggered. This value must be an integer between instances.min and instances.max values, inclusive (see the descriptions of instances.min and instances.max).

spec.scaleRule.trigger.gracePeriodSeconds

Optional

The minimum amount of time that must pass before a scale-down action happens after any scaling event.

The default is 300 (in seconds), but you can set any positive integer or 0. During the grace period, the autoscaler does not initiate a scale-down if the last scaling action was within the grace time window. Scale-up actions are not affected by the grace period. Setting a grace period of 0 deactivates the grace period for this object, that is, allows for immediate scale-down actions.

spec.scaleRule.trigger.metric.name

Required

The metric that scaling decisions are based on. For options, refer to the Metric Type column in the Metrics table.

For more information, see the spec.scaleRule.trigger.metric.name section in Tanzu Service Mesh Autoscaler Configuration Details.

spec.scaleRule.trigger.metric.scaleUp

Required

This integer value determines the threshold that is used per service instance to initiate a scale-up action. The value can be either a percent or absolute number, depending on the spec.scaleRule.trigger.metric.name that is set. The value set for spec.scaleRule.trigger.metric.scaleUp must be greater than the value of spec.scaleRule.trigger.metric.scaleDown. For more metrics information, see the Metrics table.

spec.scaleRule.trigger.metric.scaleDown

Required

This integer value determines the threshold that is used per service instance to initiate a scale-down action. The value can be either a percent or absolute number, depending on the spec.scaleRule.trigger.metric.name that is set. Percentage values must be between 1 and 100, inclusive. spec.scaleRule.trigger.metric.scaleDown must be less than the value of spec.scaleRule.trigger.metric.scaleUp. For more metrics information, see the Metrics table in this topic.

spec.scaleRule.trigger.metric.windowSeconds

Optional

Metrics are based on an average over a certain period. You set this period, or “look-back” window, here. The number (integer) can be between 60 and 3600 seconds, inclusive. The default is 600 seconds or ten minutes.

Tanzu Service Mesh Autoscaler Configuration Properties in the Tanzu Service Mesh Console UI

You can configure a Tanzu Service Mesh Service autoscaler through the Tanzu Service Mesh Console UI. Shown here is an example Autoscaling window for a GNS-scoped autoscaler. This example describes all fields that are supported by the autoscaler through the UI.

The following table describes the property fields that you use to configure an autoscaling policy in the Tanzu Service Mesh Console UI.

Table 2. Autoscaling policy configuration property fields

Field Name

Required/Optional

Description

Autoscaling Policy Name

Required

Name of this autoscaling policy

Description

Optional

A brief description of the autoscaling policy

GNS Scope (Global Namespace Scope)

Required

When the autoscaling policy is applied, it will be scoped to the global namespace specified here.

Labels

Optional

Labels can be used to organize and select subsets of objects.

Target Service

Required

Name of the microservice being scaled within the global namespace.

Service Version

Required

Autoscaling configurations must target a service version in Tanzu Service Mesh that corresponds to specific Deployment, StatefulSet, or ReplicaSet in Kubernetes.

Warning:

Ensure that there is only one autoscaling definition per service.

Autoscaling mode

Required

Determines if the service will scale up only (Performance mode) or scale up and down (Efficiency mode). Options: EFFICIENCY or PERFORMANCE.

Autoscaling metric

Required

The metric that scaling decisions are based on.

For the available metrics, see the Metric Type column in the Autoscaler Metric Reference section. For more information, see the spec.scaleRule.trigger.metric.name section in Tanzu Service Mesh Service Autoscaler Configuration Details.

Scale Up Condition

Required

This integer value determines the threshold that is used per service instance to initiate a scale-up action. The value can be either a percent or absolute number, depending on the autoscaling metric. The value set for Scale Up condition must be greater than the value of Scale Down condition. For more information about the metrics that are available for autoscaling, see the Autoscaling Metrics Reference section.

Scale Down Condition

Required

This integer value determines the threshold that is used per service instance to initiate a scale-down action. The value can be either a percent or absolute number, depending on the autoscaling metric that is set. Percentage values must be between 1 and 100. Scale down condition must be less than the value of scale up condition. For more information about the metrics that are available for autoscaling, see the Autoscaling Metrics Reference section.

Min Instance Count

Required

The minimum number of service instances that the autoscaler is allowed to set. Must be an integer between 1 and 1000.

Max Instance Count

Required

The maximum number of service instances that the autoscaler is allowed to set. Must be an integer between 1 and 1000.

Stepped Scaling Method

Optional

Scale instances based on the steps is set here.

TSM Default Autoscaling

Optional

The default number of instances to use when the autoscaler has insufficient information on the service instances running. In such a case, if the current number of instances is less than the default number of instances, scaling up is triggered. This value must be an integer between the instances.min and instances.max values (see the descriptions of instances.min and instances.max).

Autoscaler Metrics Reference

The following table shows what metrics can be used with Tanzu Service Mesh Service Autoscaler. All values are integers. Metrics are averaged across all instances of a service.

Table 3. Metrics table

Metric Type

Unit

Description

Example

CPUUsageMillicores

millicores

CPU usage in millicores of the whole pod. Must be 1 or greater.

40

CPUUsagePercent

percent

CPU usage as a percent of what is specified in resources.requestsof the Kubernetes pod spec. Must be between 1 and 100, inclusive.

50

MemoryUsagePercent

percent

Memory usage as a percent of what is specified in resources.requests of the Kubernetes pod spec. Must be between 1 and 100, inclusive.

80

MemoryUsageBytes

bytes

Memory usage in bytes of the whole pod. Must be 1 or greater.

118093859

RequestsPS

per second

Number of requests made to the service in one second.

30

Requests

count

Number of requests made to the service during the metric time window set in spec.scaleRule.trigger.metric.windowSeconds.

366

p50Latency

milliseconds

The 50th percentile latency. Fifty percent of all requests to the service take less time (measured in milliseconds) than the value (in milliseconds) set for this metric. Value must be 1 or greater.

For more information, see the spec.scaleRule.trigger.metric.namesection in Tanzu Service Mesh Service Autoscaler Configuration Details.

589

p90Latency

milliseconds

The 90th percentile latency. Ninety percent of all requests to the service take less time (measured in milliseconds) than the value (in milliseconds) set for this metric. Value must be 1 or greater. For more information, see the spec.scaleRule.trigger.metric.name section in Tanzu Service Mesh Service Autoscaler Configuration Details.

956

p99Latency

milliseconds

The 99th percentile latency. Ninety-nine percent of all requests to the service take less time (measured in milliseconds) than the value (in milliseconds) set for this metric. Value must be 1 or greater. For more information, see the spec.scaleRule.trigger.metric.name section in Tanzu Service Mesh Service Autoscaler Configuration Details.

1541

Autoscaling API Reference

This table provides a brief summary of the autoscaling endpoints and HTTP methods in Tanzu Service Mesh Rest API.

Table 4. Autoscaling API Reference

HTTP Method

Endpoint

Description

PUT Autoscaling Policy

PUT /v1alpha1/global-namespaces/{gnsID}/autoscaling-policies/{policyID}

Edit the configuration of an autoscaling policy with a given ID (name) in a given global namespace.

GET Autoscaling Policy

GET /v1alpha1/global-namespaces/{gnsID}/autoscaling-policies/{policyID}

Retrieve a list of existing autoscaling policies with a given ID (name) in a given global namespace.

DELETE Autoscaling Policy

DELETE /v1alpha1/global-namespaces/{gnsID}/autoscaling-policies/{policyID}

Delete an autoscaling policy with a given ID (name) in a given global namespace.

GET All Autoscaling Policies

GET /v1alpha1/global-namespaces/{gnsID}/autoscaling-policies

Retrieve all autoscaling policies in a given global namespace or for a particular service in the global namespace.

GET Autoscaling Policy by Service

GET /v1alpha1/global-namespaces/{gnsID}/autoscaling-policies?name={svcName}&kind={serviceVersion}

Retrieve an autoscaling policy with a given service name and service version in a given global namespace.