Skip to content

Commit 8715bae

Browse files
authored
Merge pull request #278417 from dknappettmsft/patch-1
AVD tidy up of host pool load balancing
2 parents fa59241 + 7bf7095 commit 8715bae

File tree

1 file changed

+71
-50
lines changed

1 file changed

+71
-50
lines changed
Lines changed: 71 additions & 50 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:
@@ -59,26 +58,23 @@ To configure load balancing for a pooled host pool, you need:
5958

6059
### [Azure portal](#tab/portal)
6160

62-
To configure load balancing with the Azure portal:
61+
Here's how 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

81-
Here's how to configure load balancing with Azure PowerShell.
77+
Here's how to configure load balancing with Azure PowerShell:
8278

8379
[!INCLUDE [include-cloud-shell-local-powershell](includes/include-cloud-shell-local-powershell.md)]
8480

@@ -87,31 +83,50 @@ 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+
$parameters = @{
87+
Name = '<HostPoolName>'
88+
ResourceGroupName = '<ResourceGroupName>'
89+
LoadBalancerType = 'BreadthFirst'
90+
}
91+
92+
Update-AzWvdHostPool @parameters
9193
```
9294

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

9597
```powershell
96-
Update-AzWvdHostPool -ResourceGroupName <resourcegroupname> -Name <hostpoolname> -LoadBalancerType 'DepthFirst' -MaxSessionLimit 10
98+
$parameters = @{
99+
Name = '<HostPoolName>'
100+
ResourceGroupName = '<ResourceGroupName>'
101+
LoadBalancerType = 'DepthFirst'
102+
MaxSessionLimit = '10'
103+
}
104+
105+
Update-AzWvdHostPool @parameters
97106
```
98107

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

101-
```powershell
102-
Get-AzWvdHostPool -ResourceGroupName <resourcegroupname> -Name <hostpoolname> | format-list Name, LoadBalancerType, MaxSessionLimit
103-
```
110+
```powershell
111+
$parameters = @{
112+
Name = '<HostPoolName>'
113+
ResourceGroupName = '<ResourceGroupName>'
114+
}
115+
116+
Get-AzWvdHostPool @parameters | Format-Table Name, LoadBalancerType, MaxSessionLimit
117+
```
104118

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

121+
```output
122+
Name LoadBalancerType MaxSessionLimit
123+
----------- ---------------- ---------------
124+
contosohp01 DepthFirst 10
125+
```
111126

112127
### [Azure CLI](#tab/cli)
113128

114-
Here's how to configure load balancing with Azure CLI.
129+
Here's how to configure load balancing with Azure CLI:
115130

116131
[!INCLUDE [include-cloud-shell-local-cli](includes/include-cloud-shell-local-cli.md)]
117132

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

122137
```azurecli
123138
az desktopvirtualization hostpool update \
124-
--resource-group $resourceGroupName \
125-
--name $hostPoolName \
126-
--load-balancer-type BreadthFirst
139+
--resource-group <ResourceGroupName> \
140+
--name <HostPoolName> \
141+
--load-balancer-type BreadthFirst
127142
```
128143

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

131146
```azurecli
132147
az desktopvirtualization hostpool update \
133-
--resource-group $resourceGroupName \
134-
--name $hostPoolName \
148+
--resource-group <ResourceGroupName> \
149+
--name <HostPoolName> \
135150
--load-balancer-type DepthFirst \
136151
--max-session-limit 10
137152
```
138153

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

141-
```azurecli
142-
az desktopvirtualization hostpool show
143-
--resource-group $resourceGroupName
144-
--name $hostPoolName
145-
```
156+
```azurecli
157+
az desktopvirtualization hostpool show \
158+
--resource-group <ResourceGroupName> \
159+
--name <HostPoolName> \
160+
--query "{name:name,loadBalancerType:loadBalancerType,maxSessionLimit:maxSessionLimit}" \
161+
--output table
162+
```
146163

147-
---
164+
The output should be similar to the following output:
148165

149-
>[!IMPORTANT]
150-
>When configuring depth-first load balancing, you must set a maximum session limit per session host in the host pool.
166+
```output
167+
Name LoadBalancerType MaxSessionLimit
168+
----------- ------------------ -----------------
169+
contosohp01 DepthFirst 10
170+
```
151171

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.
172+
---
154173

174+
> [!NOTE]
175+
> 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.
155176
156-
## Next steps
177+
## Related content
157178

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

0 commit comments

Comments
 (0)