Load balancing Microsoft Terminal Services
Load balancing Remote Desktop Services

Terminal services is one of the components of Microsoft Windows that allows a user to access applications and data on a remote computer over a network. Terminal services is Microsoft's implementation of thin-client terminal server computing, where Windows applications, or even the entire desktop of the computer running terminal services, are made accessible to a remote client machine. In Windows 2008 R2, Terminal Services was renamed as Remote Desktop Services.

The fundamental purpose of deploying a load balancer is to share the load from multiple clients between two or more back-end terminal servers. Typically, all terminal servers within the cluster / farm have the same applications installed to ensure all clients get the same applications irrespective of which server they are connected to. The default TCP port used by Terminal Services is 3389, although this can be changed if required via the windows Registry.

An important aspect of load balancing terminal servers is persistence. Within a terminal server environment, this relates to the ability to reconnect to disconnected sessions that occur when a client session is closed rather than logged off. If this reconnection process is not handled correctly, users may not be able to return to their previous sessions. The following persistence methods are available:

IP Persistence
This is our recommended method and can be used in most cases. It does rely on each client having a unique IP address, so if clients connect via some form of NAT device, this may not work (since the source IP address for all clients may be the same).

RDP Cookies
This method utilizes the cookie sent from the client in the initial Connection Request PDU. This cookie is created when the username is entered at the first client login prompt (mstsc.exe). If the username is not entered here, the cookie is not created.

NOTE: Please refer to this blog post for further information on this method.

Microsoft Session Directory / Connection Broker
Session Directory (Windows 2003) / Connection Broker (Windows 2008 R2) provides functionality that allows a group of terminal servers to coordinate the reconnection of disconnected sessions. All sessions are stored as records in a central database. This database is updated and queried by the terminal servers whenever users log on, log off, or disconnect their session while leaving their applications active.

The load balancer is able to interact with Session Directory / Connection Broker by enabling Routing Token Redirection mode. This mode allows the reconnection of disconnected sessions by utilizing a routing token to enable the load balancer to re-connect the client to the correct terminal server.

The entire Loadbalancer.org ENTERPRISE product range supports load balancing Microsoft Terminal Services and starts from as little as $1,495

Please see our full Microsoft Terminal Services Deployment Guide for further information.