From ed2fe2826d095152989fea8f45307e58c8c7a503 Mon Sep 17 00:00:00 2001 From: Eric Liu Date: Tue, 8 Apr 2025 15:40:36 -0700 Subject: [PATCH 1/2] give example of autoscaling compose file in scaling concept page --- docs/concepts/scaling.md | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/docs/concepts/scaling.md b/docs/concepts/scaling.md index a94938e19..2ca7823f9 100644 --- a/docs/concepts/scaling.md +++ b/docs/concepts/scaling.md @@ -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: @@ -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: @@ -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. - \ No newline at end of file + +See Tutorial page [Scaling Tutorial](/docs/tutorials/scaling-your-services) \ No newline at end of file From f658c6b66dcbbe02ce642fbd1408107ed4d40c62 Mon Sep 17 00:00:00 2001 From: Eric Liu Date: Tue, 8 Apr 2025 15:55:37 -0700 Subject: [PATCH 2/2] Update scaling.md fix typo --- docs/concepts/scaling.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/concepts/scaling.md b/docs/concepts/scaling.md index 2ca7823f9..6e1f22ab0 100644 --- a/docs/concepts/scaling.md +++ b/docs/concepts/scaling.md @@ -37,7 +37,7 @@ Instead of manually adding more instances when traffic increases, an auto-scalin ### 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. +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. ```yaml services: @@ -81,4 +81,4 @@ 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) \ No newline at end of file +See Tutorial page [Scaling Tutorial](/docs/tutorials/scaling-your-services)