Skip to content

Commit 09eaf6f

Browse files
AVD tidy up of host pool load balancing
1 parent 46404ba commit 09eaf6f

File tree

1 file changed

+50
-47
lines changed

1 file changed

+50
-47
lines changed
Lines changed: 50 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
2-
title: Configure Azure Virtual Desktop load-balancing - Azure
3-
description: How to configure the load-balancing method for an Azure Virtual Desktop environment.
4-
author: Heidilohr
2+
title: Configure host pool load balancing in Azure Virtual Desktop
3+
description: How to configure the load balancing method for pooled host pools in Azure Virtual Desktop.
4+
ms.custom: devx-track-azurepowershell
55
ms.topic: how-to
6+
author: sipastak
7+
ms.author: sipastak
68
ms.date: 06/11/2024
7-
ms.author: helohr
8-
ms.custom: devx-track-azurepowershell
99
---
1010

11-
# Host pool load balancing algorithms in Azure Virtual Desktop
11+
# Configure host pool load balancing in Azure Virtual Desktop
1212

1313
Azure Virtual Desktop supports two load balancing algorithms for pooled host pools. Each algorithm determines which session host is used when a user starts a remote session. Load balancing doesn't apply to personal host pools because users always have a 1:1 mapping to a session host within the host pool.
1414

@@ -18,7 +18,7 @@ The following load balancing algorithms are available for pooled host pools:
1818

1919
- **Depth-first**, which keeps starting new user sessions on one session host until the maximum session limit is reached. Once the session limit is reached, any new user connections are directed to the next session host in the host pool until it reaches its session limit, and so on.
2020

21-
You can only configure one of the load balancing at a time per pooled host pool, but you can change which one is used after a host pool is created. However, both load balancing algorithms share the following behaviors:
21+
You can only configure one of the load balancing algorithms at a time per pooled host pool, but you can change which one is used at any time. Both load balancing algorithms share the following behaviors:
2222

2323
- If a user already has an active or disconnected session in the host pool and signs in again, the load balancer will successfully redirect them to the session host with their existing session. This behavior applies even if [drain mode](drain-mode.md) has been enabled for that session host.
2424

@@ -34,16 +34,15 @@ The breadth-first algorithm first queries session hosts in a host pool that allo
3434

3535
## Depth-first load balancing algorithm
3636

37-
The depth-first load balancing algorithm aims to saturate one session host at a time. This algorithm is ideal for cost-conscious organizations that want more granular control on the number of session hosts available in a host pool, enabling you to more easily scale down when there are fewer users.
37+
The depth-first load balancing algorithm aims to saturate one session host at a time. This algorithm is ideal for cost-conscious organizations that want more granular control on the number of session hosts available in a host pool, enabling you to more easily scale down the number of session hosts powered on when there are fewer users.
3838

3939
The depth-first algorithm first queries session hosts that allow new connections and haven't reached their maximum session limit. The algorithm then selects the session host with most sessions. If there's a tie, the algorithm selects the first session host from the query.
4040

41-
You must [set a maximum session limit](configure-host-pool-load-balancing.md#configure-load-balancing) when using the depth-first algorithm. You can use Azure Virtual Desktop Insights to monitor [the number of sessions on each session host](insights-use-cases.md#session-host-utilization) and [session host performance](insights-use-cases.md#session-host-performance) to help determine the best maximum session limit for your environment.
41+
You must [set a maximum session limit](configure-host-pool-load-balancing.md#configure-load-balancing) when using the depth-first algorithm. You can use Azure Virtual Desktop Insights to [monitor the number of sessions on each session host](insights-use-cases.md#session-host-utilization) and review [session host performance](insights-use-cases.md#session-host-performance) to help determine the best maximum session limit for your environment.
4242

4343
> [!IMPORTANT]
4444
> Once all session hosts have reached the maximum session limit, you need to increase the limit or [add more session hosts to the host pool](add-session-hosts-host-pool.md).
4545
46-
4746
## Prerequisites
4847

4948
To configure load balancing for a pooled host pool, you need:
@@ -63,18 +62,15 @@ To configure load balancing with the Azure portal:
6362

6463
1. Sign in to the [Azure portal](https://portal.azure.com).
6564

66-
2. Search for and select **Azure Virtual Desktop** under Services.
67-
68-
3. In the Azure Virtual Desktop page, select **Host pools**.
65+
1. In the search bar, enter *Azure Virtual Desktop* and select the matching service entry
6966

70-
4. Select the name of the host pool you want to edit.
67+
1. Select **Host pools**, then select the name of the host pool you want to configure.
7168

72-
5. Select **Properties**.
69+
1. Select **Properties**.
7370

74-
6. Enter the **Max session limit** into the field and select the **load balancing algorithm** you want for this host pool in the drop-down menu.
75-
76-
7. Select **Save**. This applies the new load balancing settings.
71+
1. For **Load balancing algorithm**, select which type you want to use for this host pool from the drop-down menu, then for **Max session limit**, enter a value.
7772

73+
1. Select **Save** to apply the new load balancing settings.
7874

7975
### [Azure PowerShell](#tab/powershell)
8076

@@ -87,27 +83,28 @@ Here's how to configure load balancing with Azure PowerShell.
8783
- To set breadth-first without adjusting the maximum session limit, run the following command:
8884

8985
```powershell
90-
Update-AzWvdHostPool -ResourceGroupName <resourcegroupname> -Name <hostpoolname> -LoadBalancerType 'BreadthFirst'
86+
Update-AzWvdHostPool -ResourceGroupName <ResourceGroupName> -Name <HostPoolName> -LoadBalancerType 'BreadthFirst'
9187
```
9288

9389
- To set depth-first and adjust the maximum session limit to 10, run the following command:
9490

9591
```powershell
96-
Update-AzWvdHostPool -ResourceGroupName <resourcegroupname> -Name <hostpoolname> -LoadBalancerType 'DepthFirst' -MaxSessionLimit 10
92+
Update-AzWvdHostPool -ResourceGroupName <ResourceGroupName> -Name <HostPoolName> -LoadBalancerType 'DepthFirst' -MaxSessionLimit 10
9793
```
9894

99-
3. To make sure the setting has updated, run this cmdlet:
95+
3. To make sure the setting has updated, run this command:
10096

101-
```powershell
102-
Get-AzWvdHostPool -ResourceGroupName <resourcegroupname> -Name <hostpoolname> | format-list Name, LoadBalancerType, MaxSessionLimit
103-
```
97+
```powershell
98+
Get-AzWvdHostPool -ResourceGroupName <ResourceGroupName> -Name <HostPoolName> | Format-List Name, LoadBalancerType, MaxSessionLimit
99+
```
104100

105-
```Output
106-
Name : hostpoolname
107-
LoadBalancerType : DepthFirst
108-
MaxSessionLimit : 6
109-
```
101+
The output should be similar to the following output:
110102

103+
```output
104+
Name : contosohp01
105+
LoadBalancerType : DepthFirst
106+
MaxSessionLimit : 10
107+
```
111108

112109
### [Azure CLI](#tab/cli)
113110

@@ -121,38 +118,44 @@ Here's how to configure load balancing with Azure CLI.
121118

122119
```azurecli
123120
az desktopvirtualization hostpool update \
124-
--resource-group $resourceGroupName \
125-
--name $hostPoolName \
126-
--load-balancer-type BreadthFirst
121+
--resource-group <ResourceGroupName> \
122+
--name <HostPoolName> \
123+
--load-balancer-type BreadthFirst
127124
```
128125

129126
- To set depth-first and adjust the maximum session limit to 10, run the following command:
130127

131128
```azurecli
132129
az desktopvirtualization hostpool update \
133-
--resource-group $resourceGroupName \
134-
--name $hostPoolName \
130+
--resource-group <ResourceGroupName> \
131+
--name <HostPoolName> \
135132
--load-balancer-type DepthFirst \
136133
--max-session-limit 10
137134
```
138135

139-
4. To make sure the setting has updated, run this cmdlet:
136+
3. To make sure the setting has updated, run this command:
140137

141-
```azurecli
142-
az desktopvirtualization hostpool show
143-
--resource-group $resourceGroupName
144-
--name $hostPoolName
145-
```
138+
```azurecli
139+
az desktopvirtualization hostpool show \
140+
--resource-group <ResourceGroupName> \
141+
--name <HostPoolName> \
142+
--query "{name:name,loadBalancerType:loadBalancerType,maxSessionLimit:maxSessionLimit}" \
143+
--output table
144+
```
146145

147-
---
146+
The output should be similar to the following output:
148147

149-
>[!IMPORTANT]
150-
>When configuring depth-first load balancing, you must set a maximum session limit per session host in the host pool.
148+
```output
149+
Name LoadBalancerType MaxSessionLimit
150+
----------- ------------------ -----------------
151+
contosohp01 DepthFirst 10
152+
```
151153

152-
>[!NOTE]
153-
> The depth-first load balancing algorithm distributes sessions to session hosts based on the maximum session host limit (`-MaxSessionLimit`). When you set breadth-first, the parameter's default value is `999999`, which is also the highest possible number you can set this variable to. For the best possible user experience, make sure to change the maximum session host limit parameter to a number that best suits your environment.
154+
---
154155

156+
> [!NOTE]
157+
> The depth-first load balancing algorithm distributes sessions to session hosts up to the maximum session limit. If you use breadth-first when first creating a host pool, the default value for the maximum session limit is set to `999999`, which is also the highest possible number you can set this parameter to. For the best possible user experience when using depth-first load balancing, make sure to change the maximum session limit parameter to a number that best suits your requirements.
155158
156-
## Next steps
159+
## Related content
157160

158-
- Understand how [autoscale](autoscale-scenarios.md) can automatically scale the number of available session hosts in a host pool.
161+
- Understand how [autoscale](autoscale-scenarios.md) can automatically scale the number of available session hosts in a host pool.

0 commit comments

Comments
 (0)