Introduction
Modern cloud-native applications often face unpredictable workloads — sudden traffic spikes, bursty event streams, or periods of zero activity. Azure Container Apps (ACA) solves this challenge by offering built-in serverless, event-driven autoscaling — all powered by KEDA (Kubernetes-based Event Driven Autoscaler) behind the scenes.
In this deep dive, we’ll cover:
- How autoscaling works inside ACA
- The role of KEDA (without managing Kubernetes)
- Types of scaling ACA supports
- Practical YAML configuration examples
- Real-world use cases
By the end, you’ll know how to design and implement autoscaling logic for your container apps in ACA, without worrying about Kubernetes internals.
⚙️ What is KEDA?
KEDA is an open-source component for Kubernetes that allows containers to scale dynamically based on external event triggers or metrics.
Kubernetes Event-driven Autoscaling was built to solve a common problem in Kubernetes:
How do you autoscale apps based on non-resource metrics like queue length or event counts?
KEDA Supported Trigger Types (used inside Azure Container Apps):
| Trigger Type | Example Use Cases |
|---|---|
| HTTP request concurrency | Public APIs, Webhooks |
| Azure Service Bus Queue | Message queue processing |
| Azure Storage Queues | Event-driven microservices |
| Kafka / RabbitMQ | Stream processing |
| CPU / Memory | Resource-based scale out (Dedicated Plan only) |
Good news:
In ACA, you don’t install or operate KEDA manually.
Microsoft manages it within the ACA control plane.
🧱 How Autoscaling Works in ACA Internally (Under the Hood)
Here’s the high-level flow:
- You define scale triggers in your ACA YAML, CLI, or Bicep/ARM template.
- ACA’s platform control plane registers these scale rules into KEDA ScaledObjects.
- KEDA continuously monitors the trigger source (like a Service Bus queue or HTTP request rate).
- When the trigger condition is met, KEDA tells ACA to increase or decrease the number of replicas (container instances).
Types of Autoscaling in Azure Container Apps
| Type | Description | ACA Plan Support |
|---|---|---|
| HTTP-based scaling | Based on concurrent HTTP requests per replica | Both Consumption & Dedicated |
| Event-driven scaling | Based on external trigger metrics (queues, Kafka, etc.) | Both |
| CPU/Memory-based scaling | Based on container CPU/memory usage | Dedicated Plan only |
| Scheduled scaling | Not directly supported yet in ACA (but can be simulated with Jobs + Event Grid) | ❌ |
1: HTTP Request-Based Autoscaling
Suppose you run a public-facing REST API with unpredictable traffic spikes.
YAML Definition:
scale:
minReplicas: 1
maxReplicas: 10
rules:
- name: http-scale
http:
concurrentRequests: 100
What happens at runtime:
- ACA will always keep at least 1 replica running.
- When incoming concurrent HTTP requests per replica exceed 100,
ACA will scale out horizontally up to 10 replicas.
CLI Deployment Example:
az containerapp create \
--name my-http-api \
--resource-group my-rg \
--environment my-aca-env \
--image myregistry.azurecr.io/myapi:latest \
--scale-rule-name http-scale \
--scale-rule-type http \
--scale-rule-metadata concurrentRequests=100 \
--min-replicas 1 \
--max-re
2: Event-Driven Scaling (Service Bus Queue Trigger)
Imagine you’re processing messages from an Azure Service Bus Queue, and you want to scale out whenever there are more than 50 unprocessed messages.
YAML Definition:
scale:
minReplicas: 0
maxReplicas: 20
rules:
- name: sb-queue-scaler
azureServiceBusQueue:
queueName: orders-queue
namespace: myservicebusns
messageCount: 50
CLI Deployment Example:
az containerapp create \
--name sb-consumer-app \
--resource-group my-rg \
--environment my-aca-env \
--image myregistry.azurecr.io/queueprocessor:latest \
--scale-rule-name sb-queue-scaler \
--scale-rule-type azure-servicebus \
--scale-rule-metadata queueName=orders-queue namespace=myservicebusns messageCount=50 \
--min-replicas 0 \
--max-replicas 20
Result:
ACA will scale out more replicas as soon as there are 50+ messages pending.
⚡ Scale-to-Zero: A Cost-Saving Superpower
For event-driven apps, ACA supports automatic scale-to-zero, meaning you pay nothing when there’s no load.
| Feature | Benefit |
|---|---|
| No active replicas | No CPU/memory charges |
| Trigger-based activation | App “wakes up” instantly when a new event comes |
Example Use Case:
A Service Bus message handler that only runs during business hours when messages arrive.
🎯 Concurrency Management: Tuning HTTP Performance
For HTTP apps, concurrency per replica is a key performance tuning parameter.
| Parameter | What it Means |
|---|---|
maxConcurrentRequests | How many simultaneous HTTP requests a single replica can handle before ACA triggers scale out |
Example:
If your container app can handle 50 concurrent requests efficiently, set:
scale:
rules:
- name: http-scale
http:
concurrentRequests: 50
What ACA Does Behind the Scenes with KEDA
Though users never interact with raw KEDA objects, here’s what Azure is doing internally for each scaling rule:
| ACA Config Element | Backend KEDA Resource |
|---|---|
| HTTP scale rule | KEDA HTTP ScaledObject |
| Event-driven rule | KEDA ScaledObject |
| Job triggers (for ACA Jobs) | KEDA ScaledJob |
| Metrics polling | KEDA Metrics Adapter |
Best Practices for ACA Autoscaling
| Best Practice | Why |
|---|---|
Always set minReplicas for critical apps | Avoid cold start for production APIs |
| Test your app’s concurrency limit under load | Prevent overloading a single replica |
| Use event-driven scale rules for background processing | Saves cost and improves efficiency |
| Monitor scaling behavior in Azure Monitor | Helps optimize trigger thresholds |
Real-World Use Case Scenario: Order Processing System
Imagine an e-commerce app with:
| Component | ACA App | Scaling Trigger |
|---|---|---|
| Public API | API Gateway app | HTTP concurrency |
| Order Queue Consumer | Worker app | Service Bus queue length |
| Notification Sender | Email/SMS app | Service Bus topic subscription |
Using ACA and KEDA-backed scaling, each component scales independently based on its trigger type.
Conclusion:
Autoscaling in Azure Container Apps is powerful, flexible, and requires almost zero infrastructure management. By leveraging KEDA under the hood, ACA offers the best of both worlds: Kubernetes-grade event-driven scaling with serverless simplicity.