XenServer在启用Intellicache功能以后,作为虚拟桌面的基础架构服务器部署,能够有效的利用本地存储和共享存储,减少共享存储的压力。特别对单一镜像的虚机带来的存储性能要求大大降低,缓存减少了网络的压力同时,降低了存储的压力。

Intellicache在启动时,会缓存VM的Parent VDI(父VDI,主VDI)的数据。Local Cache(本地缓存)将作为Parent VDI的数据在以后的读的缓存,这样,当大量的VM共享一个parent VDI(比如MCS在同一个SR中,共享同一个master p_w_picpath),一个虚机的数据请求会被local cache缓存,这样,在其他VM再次访问的时候,就能提供数据访问速度,减少对共享存储上的parent VDI的访问。
另外,为了启用Intellicache,在安装的时候需要开启thin provisioning。Thin Provisioning可以增加可用的存储空间,相比于LVM,更加适合作为共享存储的本地缓存,因为EXT形式的SR,VM是以VHD格式保存,按需分配,而Intellicache需要再本地有一个VDI-UUIS.vhdcache的VDI,如果使用LVM,那么对容量的需求将大大超过预期,所以,Citrix选择了在EXT3文件系统上启用Intellicache功能。
启用Intellicache比较简单,有一个前提要求就是local Storage(或者local SR)需要是EXT3文件系统。

1、在安装的时候,直接启用thin Provosioning,如下图:

2、如果安装的时候,没有启用该选项,默认的Local Storage是以LVM来管理的本地存储,我们需要手动转换成EXT,注意,转换会导致LVM上原有的VM VDI丢失,所以请备份或者迁移后操作。

1
2
3
4
5
6
7
8
9
10
11
12
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 /etc/firstboot .d /state/10-prepare-storage
rm -f /etc/firstboot .d /state/15-set-default-storage
service firstboot start
xe sr-list type =ext

脚本就不详细解释了,以上脚本用于把LVM格式的本地存储转换成EXT格式,注:需要脚本方式执行

1
2
3
4
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 >

启用本地缓存,设置该本地存储用于保存缓存数据。

以上在主机上启用了Intellicache功能。第二种方法的两步操作其实同安装的时候勾选ThinProvisioning以后,由系统自动配置相同。

说明:

这里只是讲在XenServer中启用Intellicache功能,启用了该功能支持,并不表示,VM或者XenDesktop部署到这些XenServer主机上的Virtual Desktop已经启用了Intellicache的功能(或者说,已经具备了本地缓存功能)。