Monday, 12 October 2015

Citrix XenDesktop 7 Connection Leasing (LHC replacement)

Citrix XenDesktop 7.6 Connection Leasing

Description

When Citrix changed the management architecture from IMA to FMA we faced a challenge in that database connectivity became important as without we lost management and the users could not make new connections. 

The "IMA" architecture featured a LHC (local Host Cache) Feature which kept a subset of database information on Farm Controllers. This meant a loss of connection to the database server would only impact the administrators. 

The newer "FMA" architecture had no such caching option and as such always required access to the SQL database to service admin and user requests.

This meant that we had a much greater reliance on a High available SQL than before. 

The release of XenDesktop 7.6 gave us a feature called "Connection Leasing" which gives us back a similar safety net that LHC had given us. 

The connection leasing feature supplements the SQL Server high availability best practices by enabling users to connect and reconnect to their most recently used applications and desktops, even when the Site database is not available.
Connections are cached for a lease period of two weeks. So, if the database becomes unavailable, the desktops and applications that the user launched in the previous two weeks remain accessible to that user through StoreFront. However, desktops and applications that have not been launched during the previous two-week lease period are not accessible when the database is unavailable
Connection Leasing will only occur in the event of a failure of all controllers within a site.

Database Sync

Each controller retrieves the sync information from the SQL database. This is throttled at a rate of up to 1000 leases every 10 seconds until all leases are synchronized.

Lease Files

The lease files are stored by default in
%programdata%\Citrix\Broker\Cache
The number of expected lease files can be calculated  using the following formula for Desktop accessible via LAN and Access Gateway.
(Users *2) + (Users * Desktops) + (Users * Application delivery groups) + VDAs
Leases file vary in size (0.5K – 512K) but will typically consume 4K blocks on NTFS file systems.

Example VDI Sizing

table to follow

VDA Registration

During connection leasing there is a 2 minute period at the start and end of the outage where VDAs maybe un-registered and then re-registered. This can have a performance impact with large amounts of machines registering in a short period.
In the event that some controllers remain connected to the database while others  fail, VDAs should register themselves with the working controller. Connection Leasing will only occur in the event of a failure of all controllers within a site.

SQL TimeOut

SQL queries have a default of 30s before they are deemed to have timed out, then the controllers will wait another 90s for a response, giving a total of 120 seconds before leasing will activate. This value can be altered if desired. (see parameters table)

Query Commands

The following commands can be used to view Broker Leasing information.
Set-BrokerSite -ConnectionLeasingEnabled $true|$false - Turns connection leasing on or off. Default = $true 
Get-BrokerServiceAddedCapability - Outputs “ConnectionLeasing” for the local Controller. 
Get-BrokerLease - Retrieves either all or a filtered set of current leases. 
Remove-BrokerLease - Marks either one or a filtered set of leases for deletion. 
Update-BrokerLocalLeaseCache – Updates the connection leasing cache on the local Controller. The data is resynchronized during the next synchronization.

Configurable Parameters

table to follow

No comments:

Post a Comment