Skip to content

Commit efef6e5

Browse files
authored
Merge pull request #201 from DefangLabs/eric-scaling-example
give example of autoscaling compose file in scaling concept page
2 parents e49421f + f658c6b commit efef6e5

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

docs/concepts/scaling.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Scaling is the process of adjusting the number of instances (or replicas) of a s
1010

1111
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.
1212

13+
1314
## Why Scale?
1415

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

3536
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.
3637

38+
### Example
39+
40+
With Defang a user, with a Pro and higher plan, can enable service level autoscaling by adding a _**x-defang-autoscaling**_ extension to the service which is to be autoscaled.
41+
42+
```yaml
43+
services:
44+
service-example:
45+
x-defang-autoscaling: true #enable autoscaling for this service
46+
build:
47+
context: .
48+
dockerfile: Dockerfile
49+
ports:
50+
- mode: ingress
51+
target: 8080
52+
published: 8080
53+
```
54+
3755
### How It Works
3856
3957
Auto-scaling systems typically rely on:
@@ -62,4 +80,5 @@ Auto-scaling systems typically rely on:
6280
6381
- Ensure services are **stateless** or use **externalized state** (e.g., databases, caches) for smooth scaling. ([12 Factor App](https://12factor.net/processes))
6482
- Test services under load to identify scaling bottlenecks.
65-
83+
84+
See Tutorial page [Scaling Tutorial](/docs/tutorials/scaling-your-services)

0 commit comments

Comments
 (0)