Slow application on Citrix / RDS – TSFairShare

Earlier this year we did an implementation of a new 2016 Citrix site for a customer. They told us before the project started that one of their main Apps was not performing well on 2012R2, so we were hoping for more success on 2016.

After implementing the new servers we tried out the application and launch time went from 40 seconds on 2008R2 to a whopping 3,5 minutes on a well scaled 2016 server with one user!

The odd thing when troubleshooting was this;

  • Application without any plugins – 20 second launch time
  • Nothing weird in Netstat / Firewall / Taskmanager (Normal load)
  • Tried different Netsh commands to no avail
  • Procmon – Looked normal initially
  • Vendor claimed that they had no issues running on Citrix

What really delayed our troubleshooting was the fact that if you left a Citrix / RDP session over night the application would start in 24 seconds (!!??)

— But if you logged out and in it would be back to 3,5 minutes.

This added a lot more confusion as to what was causing the issue, we looked through all services / scheduled tasks to see if any of those could have an impact.

Realization; 

  1. There was time missing in Procmon when the application was launching – Not much, but a little here and there (example photo – not from case)

 

  1. Turning off filters and seeing more did not help
  1. Turning of the default filters that are “always on” got us on track

  1. We then saw that the system process was involved here and there;

  1. And by taking a closer look we found tsfairshare.sys

Solution

And with that knowledge we were able to find this registry setting that is per-default enabled on servers with the RDS role from 2012R2 and upwards;

By changing EnableFairShare for Disk to a 0 and without rebooting or anything the application launch time was down to;

20 seconds! 🙂

This registry key exists for CPU, DISK and Network and they are all enabled by default.

Disk;

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TSFairShare\Disk

Network;

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TSFairShare\NetFS

CPU;

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Quota System

Summary;

Normally Fair Sharing is a good idea as the name suggests it gives all users a fair share of the resources available on the server.

This application was rather file-intensive at startup and even with one user on the server it seems like the fair sharing is using to much resources trying to control it and in effect slowing the application down a lot.

What I still can’t wrap my head around is the fact that a session that we let stay on the server overnight somehow don’t get controlled by TsFairShare (for disk at least) it might be a bug that the service times out.

If anyone knows the answer to this – Feel free to send us an email!

 

 

 

 

 

 

Comments are closed.