When you configure an anti-affinity rule for an application pool, Horizon Connection Server attempts to launch the application only on multi-session hosts that have sufficient resources to run the application. This feature can be useful for controlling applications that consume large amounts of CPU or memory resources.

An anti-affinity rule consists of an application matching pattern and a maximum count. For example, the application matching pattern might be autocad.exe and the maximum count might be 2.

Horizon Connection Server sends the anti-affinity rule to Horizon Agent on a multi-session host. If any applications running on the host have process names that match the application matching pattern, Horizon Agent counts the current number of instances of those applications and compares the number to the maximum count. If the maximum count is exceeded, Horizon Connection Server skips that host when it selects a host to run new sessions of the application.

Procedure

Before you create an anti-affinity rule, become familiar with the Anti-affinity Feature Constraints.

  1. In Horizon Console, select Inventory > Applications.
  2. Select the pool to modify and click Edit.
  3. In the Anti-Affinity Patterns text box, type a comma-separated list of patterns to match against the process names of other applications running on multi-session hosts.

    The pattern string can include the asterisk (*) and question mark (?) wildcard characters. An asterisk matches zero or more characters and a question mark matches any single character.

    For example, *pad.exe,*notepad.??? matches wordpad.exe, notepad.exe, and notepad.bat, but it does not match wordpad.bat or notepad.script.

    Note: VMware Horizon 8 counts multiple patterns that match for an application in a single session as a single match.
  4. In the Anti-Affinity Count text box, type the maximum number of other applications that can be running on the host before the host is rejected for new application sessions.

    The maximum count can be an integer from 1 through 20.

  5. Click Submit to save your changes.

Anti-affinity Feature Constraints

The anti-affinity feature has certain constraints.

  • Anti-affinity rules affect new application sessions only. A multi-session host that contains sessions in which a user has previously run an application is always reused for the same application. This behavior overrides reported load preferences and anti-affinity rules.
  • Anti-affinity rules do not affect application launches from within a published desktop session.
  • In certain circumstances, the instances of applications on the host might not be restricted to the maximum count that you specify. For example, Horizon 8 cannot determine the exact instance count if other applications for other pending sessions are in the process of being launched.
  • Inter-application anti-affinity rules are not supported. For example, large application classes, such as Autocad and Visual Studio instances, cannot be counted in a single rule.
  • Do not use anti-affinity rules in environments where end users use Horizon Client on mobile clients. Anti-affinity rules can result in multiple sessions in the same farm for an end user. Reconnecting to multiple sessions on mobile clients can result in indeterminate behavior.
  • Anti-affinity rules consider only the connected number of sessions for load balancing. However, load balancing for multi-session hosts considers the sum of the connected, pending, and disconnected sessions for load balancing.