Citrix Tuning Tips

Many sites use Citrix’s XenApp servers to deploy Millennium®. Keeping Citrix properly tuned will help ensure that the data store and Citrix Zone Data Collectors (ZDCs) are able to handle the workload spike that can occur following a power outage or other unexpected spike in volume.

The ZDCs feed a data store that is usually a Microsoft SQL Server (MSDE or Express Edition), so I recommend you start your tuning with one of the free tools available over the Internet to analyze SQL Server. These tools won’t change the Citrix scripts but will tune the performance of the SQL Server kernel. They will help you look at 1) how much RAM the SQL Server is using, 2) how the disk partition is configured and 3) some registry changes that can allow the ZDCs to be able to handle transient spikes gracefully.

You want to, for instance, 1) make sure that your SQL Server is using all of the memory it can, 2) determine if you have the disk drives to allow you to split the database and log files to separate physical disks and 3) determine if you have a disk controller card that has at least 512MB of writeback cache on the controller and that the cache is configured for writeback and NOT readahead or writethrough. (Refer to your hardware vendor’s documentation on verifying the configuration of your disk controller card’s cache.)

I had read for many years that changing the block size of the partition that SQL Server is running on will dramatically improve its throughput. My colleague Rob Dearden recently performed several tests that supported the claim. So my first actionable recommendation is to get the database, log files and temp database on a drive or drive partition that has a block size of 65,536. To learn what your block size is, open a DOS prompt and type this command:

fsutil fsinfo ntfsinfo c:

The output will look something like this:

The highlighted line shows the PC’s block size, which is 4,096 instead of the desired 65,536.

The Microsoft document titled “Disk Partition Alignment Best Practices for SQL Server” outlines how to configure the disk partition to this size. Microsoft offers other informational documents as well. From the company’s website, simply search for SQL Server tuning or performance or scalability. If you are not on SQL Server 2008’s latest version, consider upgrading.

The Express Edition of SQL Server is usually used because it’s free. That version, however, is limited to 1 cpu and only 1 GB of RAM. A Workgroup version with a five-user client-access license (CAL) costs less than $800 and doubles the number of cpus and quadruples the maximum memory usable for your ZDCs.

Once you’ve tuned SQL Server, I recommend moving to the Citrix website. Citrix offers several documents outlining registry key changes that can allow the ZDCs to scale much higher than they can by default. I will highlight a few of the changes, but I recommend you download and review the Citrix documents before changing your values.

From “IMA and ZDC Communication”:

  • The default for HKEY_LOCAL_MACHINE\Software\Citrix\IMA\Runtime\MaxHostAddressCacheEntries is 512 hosts that are tracked. If you are going to have more than 512 connections to the zone, please increase this value.

From “Upgrading Hardware to Reduce Bottlenecking on the ZDC”:

  • Change HKEY_LOCAL_MACHINE\Software\Citrix\IMA\WorkQueueThreadCount (DWORD) from 8 hexadecimals to 80 hexadecimals (or 128 decimals).
  • Change HKEY_LOCAL_MACHINE\Software\Citrix\IMA\IsolationWorkQueueThreadCount (DWORD) from 8 hexadecimals to 80 hexadecimals (or 128 decimals).

These two changes outline how many concurrent threads can be active.

Key Infrastructure Server Tuning” outlines several counters you can use in Microsoft’s Performance Monitor (Perfmon) tool to look at your ZDCs’ performance. The article “Taking Your Server’s Pulse” explains more on Perfmon.

Another great freeware tool that I frequently use is TCP Optimizer. TCP Optimizer has been around for several years and, although it was designed for home networks, the tuning applies to hospitals and healthcare organizations as well. It will change your Microsoft Server 2003 settings for more consistent performance at peak loads. If you have upgraded your core Citrix servers to Microsoft Server 2008, the website walks you through the commands you have to use to tune Server 2008’s TCP/IP settings. The documentation is very good.

Two Microsoft documents are useful companions to the TCP Optimizer documentation for understanding the registry keys needed to tune the Operating System. They will help you verify what the keys mean and what the values would change.

Finally, I recommend you go to your hardware vendor’s support sites. Both HP and IBM have documents for tuning Windows Server 2003 and 2008 that provide wonderful insights into how to get the most from their hardware.