Citrix Hypervisor

IntelliCache

Using Citrix Hypervisor with IntelliCache makes hosted Virtual Desktop Infrastructure deployments more cost-effective by enabling you to use a combination of shared storage and local storage. It is of particular benefit when many Virtual Machines (VMs) all share a common OS image (the primary image). The load on the storage array is reduced and performance is enhanced. In addition, network traffic to and from shared storage is reduced as the local storage caches the primary image from shared storage.

IntelliCache works by caching data for a VM in local storage on the VM host. This local cached data includes:

  • A cached copy of the primary image (a VM’s parent VDI). This file is thin provisioned and read only. It is populated as data is read from the primary image VDI on shared storage. When many VMs share a common primary image VDI, a VM can use the data read into the cache from another VM. Further access to the primary image on shared storage is not required.
  • A cached copy of the per-VDI delta disk. Changes can be written to this local delta disk. For non-persistent VMs, data in the local cached delta disk is discarded on VM boot. For persistent VMs, data in the local cached delta disk is written back to the delta disk on the shared storage on VM boot.

Prerequisites

The IntelliCache feature has the following requirements:

  • Premium Edition license: IntelliCache is only supported when using Citrix Hypervisor Premium Edition with Citrix Virtual Desktops.

  • Storage: To use IntelliCache, you require both a local SR for the cached data and a shared SR for the source Virtual Disk Image (VDI). Use these SRs only for IntelliCache VMs. Do not mix traditional virtual machines and IntelliCache VMs on the same SR.

    • Shared storage: The shared storage type, used to host the source VDI, must be NFS.

    • Local storage: We recommend that you use a high performance local storage device to ensure the fastest possible data transfer. For example, use a Solid State Disk or a high performance RAID array. Consider both data throughput and storage capacity when sizing local disks.

      A thin-provisioned, EXT3/EXT4 local SR is required for IntelliCache. Thin provisioning must be enabled for Citrix Virtual Desktops local caching to work properly. You can enable thin provisioning at Citrix Hypervisor install time or later, at the command line. Thin provisioning changes the default local storage type of the host from LVM to EXT4. For more information, see IntelliCache deployment.

      Thin provisioning is a way of optimizing the use of available storage. This approach allows you to make more use of local storage instead of shared storage. It relies on on-demand allocation of blocks of data. In other approaches, all blocks are allocated up front. Thin provisioning allows the administrator to present more storage space to the VMs connecting to the Storage Repository (SR) than is available on the SR. There are no space guarantees, and allocation of a LUN does not claim any data blocks until the VM writes data.

      Thin-provisioned SRs might run out of physical space, as the VMs within can grow to consume disk capacity on demand. IntelliCache VMs handle this condition by automatically falling back to shared storage when the local SR cache is full. Do not mix traditional virtual machines and IntelliCache VMs on the same SR, as IntelliCache VMs can grow quickly in size.

IntelliCache deployment

To use the Intellicache feature, you must enable it both on Citrix Hypervisor and on Citrix Virtual Apps and Desktops.

On Citrix Hypervisor

To use IntelliCache, thin provisioning of the local SR must be enabled either during host installation or be enabled manually on a running host using the CLI. Thin Provisioning changes the default local storage type of the host from LVM to EXT4.

Enable on host installation

To enable thin provisioning during host installation, on the Virtual Machine Storage screen, select Enable thin provisioning. This option selects the host’s local SR to be the one to be used for the local caching of VM VDIs.

Convert an existing host to use thin provisioning

To delete an existing LVM local SR, and replace it with a thin-provisioned EXT3/EXT4 SR, enter the following commands.

Warning:

These commands remove your existing local SR, and VMs on the SR are permanently deleted.

localsr=`xe sr-list type=lvm host=hostname params=uuid --minimal` echo localsr=$localsr pbd=`xe pbd-list sr-uuid=$localsr params=uuid --minimal` echo pbd=$pbd xe pbd-unplug uuid=$pbd xe pbd-destroy uuid=$pbd xe sr-forget uuid=$localsr sed -i "s/'lvm'/'ext'/" /etc/firstboot.d/data/default-storage.conf rm -f /var/lib/misc/ran-storage-init systemctl restart storage-init.service xe sr-list type=ext

To enable local caching, enter the following commands:

xe host-disable host=hostname localsr=`xe sr-list type=ext host=hostname params=uuid --minimal` xe host-enable-local-storage-caching host=hostname sr-uuid=$localsr xe host-enable host=hostname

On Citrix Virtual Apps and Desktops

When connecting from Citrix Virtual Apps and Desktops to Citrix Hypervisor in Citrix Studio, select to use IntelliCache. If thin provisioning of the local SR has been enabled in Citrix Hypervisor, Citrix Studio shows the option Use IntelliCache to reduce load on the shared storage device when creating the connection to Citrix Hypervisor.

For more information, see the Citrix Virtual Apps and Desktops product documentation.

VM behavior with IntelliCache

The VDI flag on-boot dictates the behavior of a VM VDI when the VM is booted and the VDI flag allow-caching dictates the caching behavior.

The values to use for these parameters depends on the type of VM you are creating and what its intended use is:

  • For shared or randomly allocated machines:

    • Set the on-boot parameter to reset.
    • Set the allow-caching parameter to true

    For example:

    xe vdi-param-set uuid=vdi_uuid on-boot=reset allow-caching=true

    On VM boot, the VDI is reverted to the state it was in at the previous boot. All changes while the VM is running are lost when the VM is next booted. New VM data is written only to local storage. There are no writes to shared storage. This approach means that the load on shared storage is reduced. However the VM cannot be migrated between hosts.

    Select this option if you plan to deliver standardized desktops to which users cannot make permanent changes.

  • For static or dedicated machines:

    • Set the on-boot parameter to persist.
    • Set the allow-caching parameter to true

    For example:

    xe vdi-param-set uuid=vdi_uuid on-boot=persist allow-caching=true

    On VM boot, the VDI is in the state it was left in at the last shutdown. New VM data is written to both local and shared storage. Reads of cached data do not require I/O traffic to shared storage so the load on shared storage is reduced. VM migration to another host is permitted and the local cache on the new host is populated as data is read.

    Select this option if you plan to allow users to make permanent changes to their desktops.

Note:

For VMs whose VDIs are on a GFS2 SR, the VM on-boot behavior is different to VMs with VDIs on other types of SRs. For VDIs on a GFS2 SR, the on-boot option is applied on VM shutdown, not on VM boot.

Implementation details and troubleshooting

Q: Is IntelliCache compatible with live migration and high availability?

A: You can use live migration and high availability with IntelliCache when virtual desktops are in Private mode, that is, when on-boot=persist.

Warning:

A VM cannot be migrated if any of its VDIs have caching behavior flags set to on-boot=reset and allow-caching=true. Migration attempts for VMs with these properties fail.

Q: Where does the local cache live on the local disk?

A: The cache lives in a Storage Repository (SR). Each host has a configuration parameter (called local-cache-sr) indicating which (local) SR is to be used for the cache files. Typically, this SR is an EXT3/EXT4 type SR. When you run VMs with IntelliCache, you see files inside the SR with names uuid.vhdcache. This file is the cache file for the VDI with the given UUID. These files are not displayed in XenCenter. The only way of seeing them is by logging into dom0 and listing the contents of /var/run/sr-mount/sr-uuid

Q: How do I specify a particular SR for use as the cache?

A: The host object field local-cache-sr references a local SR. You can view its value by running the following command:

xe sr-list params=local-cache-sr,uuid,name-label

This field is set either:

  • After host installation, if you have chosen the “Enable thin provisioning” option in the host installer, or

  • By running xe host-enable-local-storage-caching host=host sr-uuid=sr. The command requires the specified host to be disabled. Shut down the VMs when you use this command.

The first option uses the EXT3/EXT4 type local SR and is created during host installation. The second option uses the EXT3/EXT4 type SR that is specified on the command line.

Warning:

These steps are only necessary for users who have configured more than one local SR.

Q: When is the local cache deleted?

A: The local cache includes two types of information:

  • A shared cache for the primary image disk. This shared cache file mirrors the read-only VDI from the shared storage and is not deleted or reset when actions are taken on individual VDIs.
  • A per-VDI delta disk cache for each VDI. For a non-persistent VM, the delta disk cache is reset when a VDI is attached to a VM (for example, on VM start). This cache file is only deleted when the VDI itself is deleted. If the host is offline when you delete the VDI, the SR synchronization that runs on startup garbage collects the cache file.

    Note:

    The delta disk cache file is not deleted from the host when a VM migrates to a different host or is shut down.

IntelliCache