Load Balancing sessions is an important part of the Citrix architecure. It ensures your session is placed on the best available Virtual Desktop Agent. Afterall, you don’t want to end up on a VDA alongside 23 other people when there is another VDA with only 15 users logged on to it. Not only does such a mishap affect you, it affects everyone else who is sharing that server and resources with you.
On the other hand though, it might be a good thing that load balancing happened in this way. You might have VDAs part of a Delivery Group that are better performing than others. More RAM, extra CPU and so on. Regardless of the use case, Load Index and some Citrix Studio policy settings can help achieve the right balance.
By default, load balancing works of a metric called Load Index. Out of the box, the Load Index value which can range from 0 to 10,000 is calculated based on how many sessions run on a machine. That is it. A VDA running 3 sessions will have a higher Load Index than a VDA running 2 sessions for example. Each session adds 0.4% to the Load Index.
Based on the fact that a session equals to 0.4% Load Index percentage or a Load Index value of 40, 250 sessions are allowed on a host. This is changeable via policy which I explain later on.
Here is an example of the Load Index of a VDA, as viewed from Citrix Directory. The Session Count value is 0.4% so we can assume since no default settings have been changed that there is one active session on this host.
Note: Load Index does not apply to Desktop OS machines, only Server OS.
Now when two sessions are placed on the host, the Load Index increases to 0.8%. Simple stuff.
You can also view the Load Index value from Citrix Studio by using the Select Columns action and selecting Load Index. The value here is not in percentage but rather a numerical value. Remember load is calculated from 0-10,000. Since the value here is 80, each session will increase the load by 40. 250 sessionon the host would max the value out at 10, 000.
The Load Index is also viewable using the Get-BrokerMachine PowerShell command. The value provided here is the same one shown in Studio.
To change how Load Index is calculated we can turn to Citrix Studio policies. Under Load Management whilst the setting Concurrent logons tolerance does not affect Load Index calculation, it does allow you to specify how many session logons a VDA can concurrently process.
By default 2 concurrent logons can process at one time. Logons are generally the most resource intensive so based on the performance of your VDAs you can lower or increase this value.
The CPU usage policy allows you to define a percentage upon which full load is reported. If the percentage is set at 70%, full load will be reported when a VDA CPU runs at 70%.
In this example with a 70% CPU limit set, here is an example of the Load Index being calculated at 71%. The actual VDA CPU is running at 50% in this example hosting two concurrent sessions.
When the CPU is increased above 70%, the Load Index reports Maximum Load at 100%. In Director 7.12+ you can click on failure types to get some more information. http://www.jgspiers.com/citrix-director/#Failure-Reasons
The Troubleshooting dailog shows that the Load Index has reached maximum capacity.
Once CPU consumption increases on a VDA, the Load Index increases gradually too around every 30 seconds. This ensures that a sudden spike in CPU even for 30-60 seconds will not cause a VDA to report full load.
As CPU consumption drops then Load Index drops around 1300-1500 (13-15%) roughly every 30 seconds. When Load Index is at 10000 or 100%, it takes around 2 – 2 1/2 minutes to decrease.
The CPU usage excluded process priority policy excludes processes from load calculation that have a priority of below normal or low. You can change the setting to Low or disable it completely.
Other policy settings include Disk usage and Memory usage. These values contribute to calculated Load Index along with CPU usage if enabled. By default these settings are disabled. When CPU, memory and disk usage settings are enabled the value of Load Index seems to be calculated by taking the highest value from one of these counters, and then adding 5% of the average value from the remaining counters.
A Maximum number of sessions setting also exists, this is the setting that allows you to change the maximum number of sessions that can be placed on a VDA. By default the value is 250 as discussed previously.