You can write a load balancing script to generate a load value based on any RDS host metric that you want to use for load balancing.

Your load balancing script must write the load index value to the CustomLoadValue registry key in the following location: HKLM\Sofware\VMware Inc.\VMware VDM\Performance Stats\CustomLoadValue. This value must be between 0-100.

If at least one RDS host in the farm returns a valid load value, the Connection Server assumes a load value of 25 for the other RDS hosts in farm until their load balancing scripts return valid values. If no RDS host in the farm returns a valid load value, the load balancing feature is disabled for the farm.

Note: The Horizon Console dashboard shows -1 for those RDS hosts that do not report a load index. Connection Server only uses the value of 25 for internal load balancing logic.

If your load balancing script writes an invalid load value to the CustomLoadValue registry key, the value is capped at 100 and returned as the load index to the Connection Server. If the script is unable to create the CustomLoadValue registry key, the default value of 0 is sent as the load index to the Connection Server. If the custom script does not finish running within 10 seconds, Horizon 7 terminates the script after 10 seconds and uses stale values from the CustomLoadValue registry key as the load index.

Copy your load balancing script to the Horizon Agent scripts directory (C:\Program Files\VMware\VMware View\Agent\scripts) on each RDS host in the farm. You must copy the same script to every RDS host in the farm.

For an example how to write a load balancing script, see the sample scripts in the Horizon Agent scripts directory. For more information, see Sample Load Balancing Scripts for RDS Hosts.

Upgrading Load Balancing Scripts

After a Connection Server and Horizon Agent upgrade to version 7.8 and later, earlier versions of custom scripts must write the custom load index to the CustomLoadValue registry key in the following location: HKLM\Sofware\VMware Inc.\VMware VDM\Performance Stats\CustomLoadValue. This value must be between 0-100. Custom scripts written to work with Connection Server and Horizon Agent versions earlier than 7.8 returned a number between 0-3.

You must also select the Use custom script setting in Horizon Console to enable load balancing settings for the farm. For more information on load balancing settings, see Load Balancing Settings.

Note: If you upgraded Horizon Agent to version 7.8 and later but did not upgrade Connection Server to version 7.8 and later, you cannot use custom scripts for load balancing. In this case, Horizon 7 load-balances the desktop and application sessions in the farm using the default option when no load balance settings are configured in Horizon Console.