Skip to content

Commit 8f3b20f

Browse files
authored
Merge pull request #204384 from zackliu/wps-autoscale
[WebPubSub] Add autoscale for webpubsub
2 parents 3ad38ad + d90411e commit 8f3b20f

File tree

7 files changed

+120
-0
lines changed

7 files changed

+120
-0
lines changed
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
---
2+
title: Auto scale Azure Web PubSub service
3+
description: Learn how to autoscale Azure WebPubSub service.
4+
author: zackliu
5+
ms.service: azure-web-pubsub
6+
ms.topic: conceptual
7+
ms.date: 07/12/2022
8+
ms.author: chenyl
9+
---
10+
11+
# Automatically scale units of an Azure WebPubSub service
12+
13+
> [!IMPORTANT]
14+
> Autoscaling is only available in Azure WebPubSub service Premium tier.
15+
16+
Azure WebPubSub service Premium tier supports an *autoscale* feature, which is an implementation of [Azure Monitor autoscale](../azure-monitor/autoscale/autoscale-overview.md). Autoscale allows you to automatically scale the unit count for your WebPubSub service to match the actual load on the service. Autoscale can help you optimize performance and cost for your application.
17+
18+
Azure WebPubSub adds its own [service metrics](concept-metrics.md). However, most of the user interface is shared and common to other [Azure services that support autoscaling](../azure-monitor/autoscale/autoscale-overview.md#supported-services-for-autoscale). If you're new to the subject of Azure Monitor Metrics, review [Azure Monitor Metrics aggregation and display explained](../azure-monitor/essentials/metrics-aggregation-explained.md) before digging into WebPubSub service Metrics.
19+
20+
## Understanding autoscale in WebPubSub service
21+
22+
Autoscale allows you to set conditions that will dynamically change the units allocated to WebPubSub service while the service is running. Autoscale conditions are based on metrics, such as **Server Load**. Autoscale can also be configured to run on a schedule, such as every day between certain hours.
23+
24+
For example, you can implement the following scaling scenarios using autoscale.
25+
26+
- Increase units when the **Connection Quota Utilization** above 70%.
27+
- Decrease units when the **Server Load** is below 20%.
28+
- Create a schedule to add more units during peak hours and reduce units during off hours.
29+
30+
Multiple factors affect the performance of WebPubSub service. No one metric provides a complete view of system performance. For example, if you're sending a large number of messages you might need to scale out even though the connection quota is relatively low. The combination of both **Connection Quota Utilization** and **Server Load** gives an indication of overall system load. The following guidelines apply.
31+
32+
- Scale out if the connection count is over 80-90%. Scaling out before your connection count is exhausted ensures that you'll have sufficient buffer to accept new connections before scale-out takes effect.
33+
- Scale out if the **Server Load** is over 80-90%. Scaling early ensures that the service has enough capacity to maintain performance during the scale-out operation.
34+
35+
The autoscale operation usually takes effect 3-5 minutes after it's triggered. It's important not to change the units too often. A good rule of thumb is to allow 30 minutes from the previous autoscale before performing another autoscale operation. In some cases, you might need to experiment to find the optimal autoscale interval.
36+
37+
## Custom autoscale settings
38+
39+
Open the autoscale settings page:
40+
41+
1. Go to the [Azure portal](https://portal.azure.com).
42+
1. Open the **WebPubSub** service page.
43+
1. From the menu on the left, under **Settings** choose **Scale out**.
44+
1. Select the **Configure** tab. If you have a Premium tier WebPubSub instance, you'll see two options for **Choose how to scale your resource**:
45+
- **Manual scale**, which lets you manually change the number of units.
46+
- **Custom autoscale**, which lets you create autoscale conditions based on metrics and/or a time schedule.
47+
48+
1. Choose **Custom autoscale**. Use this page to manage the autoscale conditions for your Azure WebPubSub service.
49+
50+
### Default scale condition
51+
52+
When you open custom autoscale settings for the first time, you'll see the **Default** scale condition already created for you. This scale condition is executed when none of the other scale conditions match the criteria set for them. You can't delete the **Default** condition, but you can rename it, change the rules, and change the action taken by autoscale.
53+
54+
You can't set the default condition to autoscale on a specific days or date range. The default condition only supports scaling to a unit range. To scale according to a schedule, you'll need to add a new scale condition.
55+
56+
Autoscale doesn't take effect until you save the default condition for the first time after selecting **Custom autoscale**.
57+
58+
## Add or change a scale condition
59+
60+
There are two options for how to scale your Azure WebPubSub resource:
61+
62+
- **Scale based on a metric** - Scale within unit limits based on a dynamic metric. One or more scale rules are defined to set the criteria used to evaluate the metric.
63+
- **Scale to specific units** - Scale to a specific number of units based on a date range or recurring schedule.
64+
65+
### Scale based on a metric
66+
67+
The following procedure shows you how to add a condition to increase units (scale out) when the Connection Quota Utilization is greater than 70% and decrease units (scale in) when the Connection Quota Utilization is less than 20%. Increments or decrements are done between available units.
68+
69+
1. On the **Scale out** page, select **Custom autoscale** for the **Choose how to scale your resource** option.
70+
1. Select **Scale based on a metric** for **Scale mode**.
71+
1. Select **+ Add a rule**.
72+
:::image type="content" source="./media/howto-scale-autoscale/default-autoscale.png" alt-text="Screenshot of custom rule based on a metric.":::
73+
74+
1. On the **Scale rule** page, follow these steps:
75+
1. Select a metric from the **Metric name** drop-down list. In this example, it's **Connection Quota Utilization**.
76+
1. Select an operator and threshold values. In this example, they're **Greater than** and **70** for **Metric threshold to trigger scale action**.
77+
1. Select an **operation** in the **Action** section. In this example, it's set to **Increase**.
78+
1. Then, select **Add**
79+
:::image type="content" source="./media/howto-scale-autoscale/default-scale-out.png" alt-text="Screenshot of default autoscale rule screen.":::
80+
81+
1. Select **+ Add a rule** again, and follow these steps on the **Scale rule** page:
82+
1. Select a metric from the **Metric name** drop-down list. In this example, it's **Connection Quota Utilization**.
83+
1. Select an operator and threshold values. In this example, they're **Less than** and **20** for **Metric threshold to trigger scale action**.
84+
1. Select an **operation** in the **Action** section. In this example, it's set to **Decrease**.
85+
1. Then, select **Add**
86+
:::image type="content" source="./media/howto-scale-autoscale/default-scale-in.png" alt-text="Screenshot Connection Quota Utilization scale rule.":::
87+
88+
1. Set the **minimum**, **maximum**, and **default** number of units.
89+
1. Select **Save** on the toolbar to save the autoscale setting.
90+
91+
### Scale to specific units
92+
93+
Follow these steps to configure the rule to scale to a specific unit range.
94+
95+
1. On the **Scale out** page, select **Custom autoscale** for the **Choose how to scale your resource** option.
96+
1. Select **Scale to a specific units** for **Scale mode**.
97+
1. For **Units**, select the number of default units.
98+
:::image type="content" source="./media/howto-scale-autoscale/default-specific-units.png" alt-text="Screenshot of scale rule criteria.":::
99+
100+
## Add more conditions
101+
102+
The previous section showed you how to add a default condition for the autoscale setting. This section shows you how to add more conditions to the autoscale setting.
103+
104+
1. On the **Scale out** page, select **Custom autoscale** for the **Choose how to scale your resource** option.
105+
1. Select **Add a scale condition** under the **Default** block.
106+
:::image type="content" source="./media/howto-scale-autoscale/additional-add-condition.png" alt-text="Screenshot of custom scale rule screen.":::
107+
1. Confirm that the **Scale based on a metric** option is selected.
108+
1. Select **+ Add a rule** to add a rule to increase units when the **Connection Quota Utilization** goes above 70%. Follow steps from the [default condition](#default-scale-condition) section.
109+
1. Set the **minimum** and **maximum** and **default** number of units.
110+
1. You can also set a **schedule** on a custom condition (but not on the default condition). You can either specify start and end dates for the condition (or) select specific days (Monday, Tuesday, and so on.) of a week.
111+
1. If you select **Specify start/end dates**, select the **Timezone**, **Start date and time** and **End date and time** (as shown in the following image) for the condition to be in effect.
112+
1. If you select **Repeat specific days**, select the days of the week, timezone, start time, and end time when the condition should apply.
113+
114+
## Next steps
115+
116+
For more information about managing autoscale from the Azure CLI, see [**az monitor autoscale**](/cli/azure/monitor/autoscale?view=azure-cli-latest&preserve-view=true).
216 KB
Loading
240 KB
Loading
101 KB
Loading
102 KB
Loading
212 KB
Loading

articles/azure-web-pubsub/toc.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,10 @@
106106
href: howto-troubleshoot-resource-logs.md
107107
- name: Move across regions
108108
href: howto-move-across-regions.md
109+
- name: Scale
110+
items:
111+
- name: Autoscale
112+
href: howto-scale-autoscale.md
109113

110114
- name: Concepts
111115
expanded: true

0 commit comments

Comments
 (0)