Skip to content

Commit 7985687

Browse files
committed
update per nick and cross-link
Signed-off-by: Hannah Hunter <[email protected]>
1 parent df02845 commit 7985687

File tree

5 files changed

+44
-36
lines changed

5 files changed

+44
-36
lines changed

articles/container-apps/TOC.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,12 @@
7575
href: authentication.md
7676
- name: Workload profiles
7777
href: workload-profiles-overview.md
78-
- name: Dapr integration
79-
href: dapr-overview.md
78+
- name: Dapr
79+
items:
80+
- name: Dapr integration
81+
href: dapr-overview.md
82+
- name: Scale Dapr components with KEDA
83+
href: dapr-keda-scaling.md
8084
- name: Azure Arc-enabled Kubernetes clusters
8185
href: azure-arc-overview.md
8286
- name: How-to guides
@@ -161,10 +165,6 @@
161165
href: storage-mounts.md
162166
- name: Plan for disaster recovery
163167
href: disaster-recovery.md
164-
- name: Dapr
165-
items:
166-
- name: Scale Dapr components with KEDA
167-
href: dapr-keda-scaling.md
168168
- name: Tutorials
169169
expanded: true
170170
items:

articles/container-apps/dapr-keda-scaling.md

Lines changed: 30 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,27 @@
11
---
2-
title: Scale Dapr components with KEDA scalers for Azure Container Apps
2+
title: Scale Dapr applications with KEDA scalers
33
description: Learn how to use KEDA scalers to scale an Azure Container App and its Dapr sidecar.
44
author: hhunter-ms
55
ms.author: hannahhunter
66
ms.service: container-apps
7-
ms.topic: how-to
8-
ms.date: 04/10/2023
7+
ms.topic: conceptual
8+
ms.date: 04/11/2023
99
---
1010

11-
# Scale Dapr components with KEDA scalers for Azure Container Apps
11+
# Scale Dapr applications with KEDA scalers
1212

13-
When scale rules are omitted on an Azure Container Apps resource, the container app is created with a default scale rule. If the resource receives no incoming traffic over a duration of five minutes, that default rule scales all replicas down to zero. This behavior can be problematic and unexpected when applying Dapr components, specifically pub/sub subscriptions and input bindings.
13+
Using [KEDA scalers](https://keda.sh/), you can scale your application and its [Dapr](https://docs.dapr.io/) sidecar when it has scaled to zero with inbound events and messages. In this guide, we demonstrate scaling a Dapr pub/sub application by setting up a KEDA scaler to watch for messages coming into the queue and triggers the Dapr sidecar to spin up.
1414

15-
Using KEDA scalers, you can scale your application and its Dapr sidecar when it has scaled to zero with inbound events and messages. However, configuring _both_ a Dapr component and a corresponding KEDA scaler isn't intuitive.
16-
17-
todo: solution - if it's redundant or complex, then why?
18-
19-
## Configure container apps for scaling
20-
21-
In this scenario:
22-
1. In a loop, a `checkout` publisher container app continuously publishes messages via the Dapr pub/sub API to the `orders` topic in Azure Service Bus.
15+
In the following scenario, we examine the Bicep for:
16+
1. A `checkout` publisher container app continuously publishes messages via the Dapr pub/sub API to the `orders` topic in Azure Service Bus.
17+
1. The Dapr Azure Service Bus component
2318
1. An `order-processor` subscriber container app subscribed to the `orders` topic receives and processes messages as they arrive.
2419

25-
Let’s look at the Bicep for:
26-
- The `checkout` and `order-processor` container apps
27-
- The Dapr Azure Service Bus component
28-
29-
todo: need actual steps - so far it's more of a scenario concept, user isn't walking through any steps.
20+
## Publisher container app
3021

31-
### Publisher container app
22+
The `checkout` publisher is a headless service that runs indefinitely and never scales down to zero.
3223

33-
The `checkout` publisher is a headless service that you want to run indefinitely and never scale down to zero.
34-
35-
Set the `minReplicas` to "1", which ensures the container app doesn't follow the default behavior.
24+
We do this by setting the `minReplicas` to "1", which ensures the container app doesn't follow the default behavior.
3625

3726
```bicep
3827
resource checkout 'Microsoft.App/containerApps@2022-03-01' = {
@@ -90,9 +79,9 @@ resource checkout 'Microsoft.App/containerApps@2022-03-01' = {
9079
}
9180
```
9281

93-
### Dapr component
82+
## Dapr Azure Service Bus component
9483

95-
Next, configure the Dapr component for connecting to Azure Service Bus via a connection string.
84+
Next, take a look at the Dapr component for connecting to Azure Service Bus via a connection string.
9685

9786
```bicep
9887
resource daprComponent 'daprComponents' = {
@@ -121,9 +110,9 @@ resource daprComponent 'daprComponents' = {
121110
}
122111
```
123112

124-
### Subscriber container app
113+
## Subscriber container app
125114

126-
In the `order-processor` subscriber, add a custom scale rule on the resource for the type `azure-servicebus`. With this scale rule, KEDA can scale up the container app and its Dapr sidecar, allowing incoming messages to be processed again while order-processor is scaled to zero.
115+
In the `order-processor` subscriber, we've added a custom scale rule on the resource for the type `azure-servicebus`. With this scale rule, KEDA can scale up the container app and its Dapr sidecar, allowing incoming messages to be processed while `order-processor` is scaled to zero.
127116

128117
```bicep
129118
resource orders 'Microsoft.App/containerApps@2022-03-01' = {
@@ -214,6 +203,21 @@ resource orders 'Microsoft.App/containerApps@2022-03-01' = {
214203
}
215204
```
216205

206+
## What happened?
207+
208+
By default, [Container Apps assigns an http-based scale rule to applications](./scale-app.md), scaling apps based on the number of incoming http requests. However, since the `order-processor` application is using the Dapr pub/sub abstraction to pull messages from a queue, it needs to define a custom scaler based on the number of messages waiting to be processed.
209+
210+
Behind the scenes, KEDA scales our `order-processor` appropriately (even down to zero). Notice the `messageCount` property on the scaler's configuration:
211+
212+
```bicep
213+
metadata: {
214+
//...
215+
messageCount: '30'
216+
}
217+
```
218+
219+
This property tells KEDA how many messages each instance of our application can process at the same time. Since the application is single-threaded, we'd normally set this value to 1, resulting in KEDA scaling up our application to match the number of messages waiting in the queue. For example, if 5 messages are waiting, KEDA will scale our app up to 5 instances. In our scenario, we set a `maxReplicas` value of 10, so KEDA scales upt to 10 instances.
220+
217221
## Next steps
218222

219223
[Learn more about using Dapr components with Azure Container Apps.](./dapr-overview.md)

articles/container-apps/dapr-overview.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ author: hhunter-ms
66
ms.service: container-apps
77
ms.custom: event-tier1-build-2022, ignite-2022
88
ms.topic: conceptual
9-
ms.date: 01/25/2023
9+
ms.date: 04/11/2023
1010
---
1111

1212
# Dapr integration with Azure Container Apps
@@ -359,13 +359,15 @@ Now that you've learned about Dapr and some of the challenges it solves:
359359
- Try [Deploying a Dapr application to Azure Container Apps using the Azure CLI][dapr-quickstart] or [Azure Resource Manager][dapr-arm-quickstart].
360360
- Walk through a tutorial [using GitHub Actions to automate changes for a multi-revision, Dapr-enabled container app][dapr-github-actions].
361361
- Learn how to [perform event-driven work using Dapr bindings][dapr-bindings-tutorial]
362+
- [Scale your Dapr applications using KEDA scalers][dapr-keda]
362363

363364
<!-- Links Internal -->
364365

365366
[dapr-quickstart]: ./microservices-dapr.md
366367
[dapr-arm-quickstart]: ./microservices-dapr-azure-resource-manager.md
367368
[dapr-github-actions]: ./dapr-github-actions.md
368369
[dapr-bindings-tutorial]: ./microservices-dapr-bindings.md
370+
[dapr-keda]: ./dapr-keda-scaling.md
369371

370372
<!-- Links External -->
371373

articles/container-apps/microservices-dapr-bindings.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ author: hhunter-ms
55
ms.author: hannahhunter
66
ms.service: container-apps
77
ms.topic: how-to
8-
ms.date: 03/08/2023
8+
ms.date: 04/11/2023
99
zone_pivot_group_filename: container-apps/dapr-zone-pivot-groups.json
1010
zone_pivot_groups: dapr-languages-set
1111
---
@@ -579,3 +579,4 @@ azd down
579579

580580
- Learn more about [deploying Dapr applications to Azure Container Apps](./microservices-dapr.md).
581581
- Learn more about [Azure Developer CLI](/azure/developer/azure-developer-cli/overview) and [making your applications compatible with `azd`](/azure/developer/azure-developer-cli/make-azd-compatible).
582+
- [Scale your Dapr applications using KEDA scalers](./dapr-keda-scaling.md)

articles/container-apps/microservices-dapr-pubsub.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ author: hhunter-ms
55
ms.author: hannahhunter
66
ms.service: container-apps
77
ms.topic: how-to
8-
ms.date: 03/16/2023
8+
ms.date: 04/11/2023
99
zone_pivot_group_filename: container-apps/dapr-zone-pivot-groups.json
1010
zone_pivot_groups: dapr-languages-set
1111
---
@@ -679,4 +679,5 @@ azd down
679679
## Next steps
680680

681681
- Learn more about [deploying Dapr applications to Azure Container Apps](./microservices-dapr.md).
682-
- Learn more about [Azure Developer CLI](/azure/developer/azure-developer-cli/overview) and [making your applications compatible with `azd`](/azure/developer/azure-developer-cli/make-azd-compatible).
682+
- Learn more about [Azure Developer CLI](/azure/developer/azure-developer-cli/overview) and [making your applications compatible with `azd`](/azure/developer/azure-developer-cli/make-azd-compatible).
683+
- [Scale your Dapr applications using KEDA scalers](./dapr-keda-scaling.md)

0 commit comments

Comments
 (0)