# [[Autoscaling]]
![[Autoscaling.svg]]
Autoscaling in [[Distributed computing]] is a process that allows software components and [[Microservices]] to dynamically increase and decrease in size, capacity, and resources in response to changing demands.
## Levels of autoscaling
Autoscaling can occur on multiple levels simultaneously.
### Pod level
Autoscaling on the pod level involves increasing the number of pods that are scheduled.
On the pod level, you can use the built-in Kubernetes tools:
- [[Kubernetes HorizontalPodAutoscaler|Horizontal Pod Autoscaler]] (HPA) scales pods up/down based on metrics like CPU, memory, or other custom ones
- [[Kubernetes Vertical Pod Autoscaler|Vertical Pod Autoscaler]] (VPA) adjusts CPU and memory [[Resource limits]] and requests without adding more replicas
### Cluster level
On the cluster level, you can use the [[Kubernetes Cluster Autoscaler]] or [[Karpenter]] by [[AWS]]. Both add and remove nodes in your cluster as needed, rescheduling or moving pods to existing nodes and cleaning up the now unused nodes. Other cloud providers have provider-specific autoscalers too:
- [[GKE Autoscaler]] for [[Google Cloud Platform|GCP]]
- [[AKS Cluster Autoscaler]] for [[Azure]]
- [[DigitalOcean]] also has built-in cluster autoscaling APIs
### Event-driven
You can also choose [[Event-driven architecture|event-driven]] tools. These respond to events like messages arriving in a queue, a new file appearing in storage, or a database entry being created.
- [[KEDA]] extends HPA with external metrics
- [[KNative Eventing]] and [[KNative Serving]]
## We don't need testing because we autoscale
Autoscaling is not a silver bullet: its mere presence does not negate the need for either [[Software Testing]] or [[Observability]]. Some concerns that need to be addressed with regards to autoscaling are:
- whether the autoscaling works as expected. [[Testing autoscaling]] is required to verify this.
- the associated costs to the business of aggressive autoscaling, or autoscaling that doesn't adequately scale back down.
- whether relying on autoscaling is unnecessarily restrictive: [[Performance|Application Performance]] tuning could address some low-hanging fruit
- Autoscaling helps with the infrastructure, but it doesn't identify bottlenecks on the application level or [[Usability Testing|usability]] defects.
%%
# Excalidraw Data
## Text Elements
## Drawing
```json
{
"type": "excalidraw",
"version": 2,
"source": "https://github.com/zsviczian/obsidian-excalidraw-plugin/releases/tag/2.1.4",
"elements": [
{
"id": "4y8R7iOA",
"type": "text",
"x": 118.49495565891266,
"y": -333.44393157958984,
"width": 3.8599853515625,
"height": 24,
"angle": 0,
"strokeColor": "#1e1e1e",
"backgroundColor": "transparent",
"fillStyle": "solid",
"strokeWidth": 2,
"strokeStyle": "solid",
"roughness": 1,
"opacity": 100,
"groupIds": [],
"frameId": null,
"roundness": null,
"seed": 967149026,
"version": 2,
"versionNonce": 939059582,
"isDeleted": true,
"boundElements": null,
"updated": 1713723615080,
"link": null,
"locked": false,
"text": "",
"rawText": "",
"fontSize": 20,
"fontFamily": 4,
"textAlign": "left",
"verticalAlign": "top",
"containerId": null,
"originalText": "",
"lineHeight": 1.2
}
],
"appState": {
"theme": "dark",
"viewBackgroundColor": "#ffffff",
"currentItemStrokeColor": "#1e1e1e",
"currentItemBackgroundColor": "transparent",
"currentItemFillStyle": "solid",
"currentItemStrokeWidth": 2,
"currentItemStrokeStyle": "solid",
"currentItemRoughness": 1,
"currentItemOpacity": 100,
"currentItemFontFamily": 4,
"currentItemFontSize": 20,
"currentItemTextAlign": "left",
"currentItemStartArrowhead": null,
"currentItemEndArrowhead": "arrow",
"scrollX": 583.2388916015625,
"scrollY": 573.6323852539062,
"zoom": {
"value": 1
},
"currentItemRoundness": "round",
"gridSize": null,
"gridColor": {
"Bold": "#C9C9C9FF",
"Regular": "#EDEDEDFF"
},
"currentStrokeOptions": null,
"previousGridSize": null,
"frameRendering": {
"enabled": true,
"clip": true,
"name": true,
"outline": true
}
},
"files": {}
}
```
%%