Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion docs/concepts/scaling.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Scaling is the process of adjusting the number of instances (or replicas) of a s

Scaling is a core concept in distributed systems and cloud-native applications. It ensures your system can handle varying workloads without degrading user experience or over-provisioning resources.


## Why Scale?

Scaling enables services to respond effectively under different conditions:
Expand All @@ -34,6 +35,23 @@ In most modern deployments, horizontal scaling is preferred because it aligns we

Instead of manually adding more instances when traffic increases, an auto-scaling system watches key indicators (like CPU usage) and takes action in real time.

### Example

With Defang a user, with a Pro and higher plan, can enable service level autoscaling by adding a _**x-defang-autoscaling**_ extension to the services which is to be autoscaled.

```yaml
services:
service-example:
x-defang-autoscaling: true #enable autoscaling for this service
build:
context: .
dockerfile: Dockerfile
ports:
- mode: ingress
target: 8080
published: 8080
```

### How It Works

Auto-scaling systems typically rely on:
Expand Down Expand Up @@ -62,4 +80,5 @@ Auto-scaling systems typically rely on:

- Ensure services are **stateless** or use **externalized state** (e.g., databases, caches) for smooth scaling. ([12 Factor App](https://12factor.net/processes))
- Test services under load to identify scaling bottlenecks.


See Tutorial page [Scaling Tutorial](/docs/tutorials/scaling-your-services)
Loading