Supported versions:
Unsupported versions:
You can scale most services running in Kubernetes from the
command line or in a configuration override. You can set scaling
parameters for Apigee hybrid runtime services in the
overrides.yaml file.
| Service | Implemented As | Scaling |
|---|---|---|
| Cassandra | ApigeeDatastore (CRD) | See Scaling Cassandra. |
| Ingress/LoadBalancer | Deployment | Anthos Service Mesh uses Horizontal Pod Autoscaling (HPAs). |
| Logger | DaemonSet | DaemonSets manage replicas of a pod on all nodes, so they scale when you scale the pods themselves. |
| MART Apigee Connect Watcher |
ApigeeOrganization (CRD) | To scale via configuration, increase the value of the
Deployment's mart: replicaCountMax: 2 replicaCountMin: 1 watcher: replicaCountMax: 2 replicaCountMin: 1 connectAgent: replicaCountMax: 2 replicaCountMin: 1 These Deployments use a Horizontal Pod Autoscaler for autoscaling. Set
the Deployment object's For more information on setting configuration properties, see Manage runtime plane components. |
| Runtime Synchronizer UDCA |
ApigeeEnvironment (CRD) | To scale via configuration, increase the value of the
replicaCountMin property for the udca, synchronizer,
and/or runtime
stanzas in the overrides file. For example:
synchronizer: replicaCountMax: 10 replicaCountMin: 1 runtime: replicaCountMax: 10 replicaCountMin: 1 udca: replicaCountMax: 10 replicaCountMin: 1 Note: These changes apply to ALL environments in the overrides file. If you wish to customize scaling for each environment see Advanced configurations below. These deployments use a Horizontal Pod Autoscaler for
autoscaling. Set the Deployment object's
For more information on setting configuration properties, see Manage runtime plane components. |
In some scenarios, you may need to use advanced scaling options. Example scenarios include:
minReplica of 5 and env2 has a minReplica of 2. udca component has a maxReplica of 5 and the
synchronizer component has a maxReplica of 2.
The following example shows how to use the kubernetes patch command to change
the maxReplicas property for the runtime component:
export ENV=my-environment-name export NAMESPACE=apigee #the namespace where apigee is deployed export COMPONENT=runtime #can be udca or synchronizer export MAX_REPLICAS=2 export MIN_REPLICAS=1
kubectl is in your PATH:
kubectl patch apigeeenvironment -n $NAMESPACE \ $(kubectl get apigeeenvironments -n $NAMESPACE -o jsonpath='{.items[?(@.spec.name == "'$ENV'" )]..metadata.name}') \ --patch "$(echo -e "spec:\n components:\n $COMPONENT:\n autoScaler:\n maxReplicas: $MAX_REPLICAS\n minReplicas: $MIN_REPLICAS")" \ --type merge
kubectl get hpa -n $NAMESPACE
With metrics-based scaling, the runtime can use CPU and application metrics to scale the apigee-runtime pods.
The Kubernetes Horizontal Pod Autoscaler (HPA) API,
uses the hpaBehavior field to configure the scale-up and scale-down behaviors of the target service.
Metrics-based scaling is not available for any other components in a hybrid deployment.
Scaling can be adjusted based on the following metrics:
| Metric | Measure | Considerations |
|---|---|---|
| serverNioTaskWaitTime | Average wait time (in picoseconds) of processing queue in runtime instances for proxy requests at the http layer. | This metric measures the impact of the number and payload size of proxy requests and responses. |
| serverMainTaskWaitTime | Average wait time (in picoseconds) of processing queue in runtime instances for proxy requests to process policies. | This metric measures the impact of complexity in the policies attached to the proxy request flow. |
The following example from the runtime stanza in the overrides.yaml
illustrates the standard parameters (and permitted ranges) for scaling apigee-runtime pods in a hybrid implementation:
hpaMetrics:
serverMainTaskWaitTime: 400M (300M to 450M)
serverNioTaskWaitTime: 400M (300M to 450M)
targetCPUUtilizationPercentage: 75
hpaBehavior:
scaleDown:
percent:
periodSeconds: 60 (30 - 180)
value: 20 (5 - 50)
pods:
periodSeconds: 60 (30 - 180)
value: 2 (1 - 15)
selectPolicy: Min
stabilizationWindowSeconds: 120 (60 - 300)
scaleUp:
percent:
periodSeconds: 60 (30 - 120)
value: 20 (5 - 100)
pods:
periodSeconds: 60 (30 - 120)
value: 4 (2 - 15)
selectPolicy: Max
stabilizationWindowSeconds: 30 (30 - 120)
Increasing the percent and pods values of the scale-up policy will result in a more aggressive
scale-up policy. Similarly, increasing the percent and pods values in scaleDown
will result in an aggressive scale-down policy. For example:
hpaMetrics:
serverMainTaskWaitTime: 400M
serverNioTaskWaitTime: 400M
targetCPUUtilizationPercentage: 75
hpaBehavior:
scaleDown:
percent:
periodSeconds: 60
value: 20
pods:
periodSeconds: 60
value: 4
selectPolicy: Min
stabilizationWindowSeconds: 120
scaleUp:
percent:
periodSeconds: 60
value: 30
pods:
periodSeconds: 60
value: 5
selectPolicy: Max
stabilizationWindowSeconds: 30In the above example, the scaleDown.pods.value is increased to 5, the scaleUp.percent.value
is increased to 30, and the scaleUp.pods.value is increased to 5.
The hpaBehavior configuration values can also be decreased to implement less aggressive scale-up and scale-down policies. For example:
hpaMetrics:
serverMainTaskWaitTime: 400M
serverNioTaskWaitTime: 400M
targetCPUUtilizationPercentage: 75
hpaBehavior:
scaleDown:
percent:
periodSeconds: 60
value: 10
pods:
periodSeconds: 60
value: 1
selectPolicy: Min
stabilizationWindowSeconds: 180
scaleUp:
percent:
periodSeconds: 60
value: 20
pods:
periodSeconds: 60
value: 4
selectPolicy: Max
stabilizationWindowSeconds: 30In the above example, the scaleDown.percent.value is decreased to 10, the scaleDown.pods.value
is decreased to 1, and the scaleUp.stablizationWindowSeconds is increased to 180.
For more information about metrics-based scaling using the hpaBehavior field, see
Scaling policies.
While metrics-based scaling is enabled by default and cannot be completely disabled, you can configure the metrics thresholds at a level that metrics-based scaling will not be triggered. The resulting scaling behavior will be the same as CPU-based scaling. For example, you can use the following configuration to prevent triggering metrics-based scaling:
hpaMetrics:
serverMainTaskWaitTime: 4000M
serverNioTaskWaitTime: 4000M
targetCPUUtilizationPercentage: 75
hpaBehavior:
scaleDown:
percent:
periodSeconds: 60
value: 10
pods:
periodSeconds: 60
value: 1
selectPolicy: Min
stabilizationWindowSeconds: 180
scaleUp:
percent:
periodSeconds: 60
value: 20
pods:
periodSeconds: 60
value: 4
selectPolicy: Max
stabilizationWindowSeconds: 30This section describes troubleshooting methods for common errors you may encounter while configuring scaling and auto-scaling.
unknown for metrics values If metrics-based scaling does not work and the HPA shows unknown
for metrics values, use the following command to check the HPA output:
kubectl describe hpa HPA_NAME
When running the command, replace HPA_NAME with the name of the HPA you wish to view.
The output will show the CPU target and utilization of the service, indicating that CPU scaling will work in the absence of metrics-based scaling. For HPA behavior using multiple parameters, see Scaling on multiple metrics.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-07-23 UTC.