Skip to main content

March 16, 2026

Writing a Load Balancing Script for a Linux Multi-session Host

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

Guidelines for Custom Load Balancing Scripts

Copy your load balancing script to a designated file on each host in the farm. To define the file path, configure the LBCustomScript option in the viewagent-custom.conf configuration file.

Your load balancing script must write the load index to a designated file on the host machine. To define the file path, configure the LBCustomScriptResult option in the viewagent-custom.conf configuration file. The load index value must be between 0-100.

Load Balancing Scenarios

The following scenarios describe the various load balancing effects that can result from custom scripts.

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

  • If no host in the farm returns a valid load value, the load balancing feature is turned off for the farm.

    Note: The Horizon Console dashboard shows -1 for those hosts that do not report a load index. Horizon 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 file defined by the LBCustomScriptResult option in viewagent-custom.conf, the value is capped at 100 and returned as the load index to Horizon Connection Server.

  • If the script cannot find a designed file to which to write the load value, the default value of 0 is sent as the load index to Horizon Connection Server.

  • If the custom script does not finish running within 10 seconds, Horizon 8 ends the script. For the load index, Horizon 8 uses stale values from the file defined by LBCustomScriptResult in viewagent-custom.conf.

Was this page helpful?

Provide feedback for this topic

Was this topic helpful?

Please do not include any personal or confidential information.

Generating link…