You can configure load balancing for RDS hosts by configuring load balancing settings in Horizon Console or by creating and configuring load balancing scripts.

By default, Connection Server uses the following formula to balance the placement of published desktop and application sessions on RDS hosts:

(connected sessions + pending sessions + disconnected sessions)/(maximum session count)

If the maximum session count is configured as unlimited, load balancing falls back to using the absolute number of the total session count which includes connected, pending and disconnected sessions.

Load Balancing Settings in Horizon Console
Horizon calculates the Server Load Index based on the load balancing settings you configure in Horizon Console. The Server Load Index indicates the load on the server. The Server Load Index can range from 0 to 100, where 0 represents no load and 100 represents full load. A Server Load Index of -1 indicates that load balancing is disabled. You can view the Server Load Index in the Horizon Console dashboard. Horizon also offers threshold values in the load balancing settings for logon storm handling. See, Load Balancing Settings.
Load Balancing Scripts
You can also override the default behavior of the load balancing settings and control the placement of new published desktop and application sessions by writing and configuring load balancing scripts.

You can write your own custom load balancing scripts, or you can use one of the sample load balancing scripts provided with Horizon Agent. To use custom load balancing scripts, you must select the Use Custom Script load balancing setting in Horizon Console.

You can run these scripts on your own schedule or run these scripts with Horizon. For more information on configuring load balancing scripts in Horizon, see Configure a Load Balancing Script on an RDS Host.

Configuring load balancing scripts involves enabling the VMware Horizon View Script Host service and setting a registry key on each RDS host in a farm.

Load balancing scripts must write the load index to the CustomLoadValue registry key with the REG_DWORD registry setting in the following location:

HKLM\Sofware\VMware Inc.\VMware VDM\Performance Stats\CustomLoadValue

The value must be between 0-100.

Horizon calculates the raw performance metrics that are written to the Performance Stats registry key in the following location:

HKLM\Sofware\VMware Inc.\VMware VDM\Performance Stats

You can use the raw performance metrics and combine these with your custom index factor for writing custom scripts.