性能优化远程桌面虚拟化主机Performance Tuning Remote Desktop Virtualization Hosts

远程桌面虚拟化主机 (RD 虚拟化主机) 是一项角色服务,它支持虚拟桌面基础结构 (VDI) 方案,并允许多个用户在运行 Windows Server 和 Hyper-v 的服务器上托管的虚拟机中运行基于 Windows 的应用程序。Remote Desktop Virtualization Host (RD Virtualization Host) is a role service that supports Virtual Desktop Infrastructure (VDI) scenarios and lets multiple users run Windows-based applications in virtual machines hosted on a server running Windows Server and Hyper-V.

Windows Server 支持两种类型的虚拟桌面:个人虚拟机和共用虚拟机。Windows Server supports two types of virtual desktops: personal virtual desktops and pooled virtual desktops.

一般注意事项General considerations

存储Storage

存储是最有可能的性能瓶颈,因此,请务必调整存储空间,以正确处理虚拟机状态更改所生成的 i/o 负载。Storage is the most likely performance bottleneck, and it is important to size your storage to properly handle the I/O load that is generated by virtual machine state changes. 如果试点或模拟不可行,最好是为四个活动虚拟机预配一个磁盘主轴。If a pilot or simulation is not feasible, a good guideline is to provision one disk spindle for four active virtual machines. 使用具有良好写入性能的磁盘配置 (如 RAID 1 + 0) 。Use disk configurations that have good write performance (such as RAID 1+0).

如果需要,请使用磁盘重复数据删除和缓存来减少磁盘读取负载,并使存储解决方案能够通过缓存大量映像来提高性能。When appropriate, use Disk Deduplication and caching to reduce the disk read load and to enable your storage solution to speed up performance by caching a significant portion of the image.

重复数据删除和 VDIData Deduplication and VDI

重复数据删除功能在 Windows Server 2012 R2 中引入,支持优化打开的文件。Introduced in Windows Server 2012 R2, Data Deduplication supports optimization of open files. 为了使用在删除了重复数据的卷上运行的虚拟机,需要将虚拟机文件存储在与 Hyper-v 主机不同的主机上。In order to use virtual machines running on a deduplicated volume, the virtual machine files need to be stored on a separate host from the Hyper-V host. 如果 Hyper-v 和重复数据删除在同一台计算机上运行,这两项功能将争用系统资源并对总体性能产生负面影响。If Hyper-V and deduplication are running on the same machine, the two features will contend for system resources and negatively impact overall performance.

还必须将卷配置为使用 "虚拟桌面基础结构 (VDI) " 重复数据删除优化类型。The volume must also be configured to use the "Virtual Desktop Infrastructure (VDI)" deduplication optimization type. 你可以使用服务器管理器 (文件和存储服务 - > - > 重复数据删除设置) 或使用以下 Windows PowerShell 命令进行配置:You can configure this by using Server Manager (File and Storage Services -> Volumes -> Dedup Settings) or by using the following Windows PowerShell command:

Enable-DedupVolume <volume> -UsageType HyperV

备注

仅支持使用 Hyper-v 通过 SMB 3.0 上的远程存储进行 Hyper-v 的 VDI 方案对打开的文件进行重复数据删除优化。Data Deduplication optimization of open files is supported only for VDI scenarios with Hyper-V using remote storage over SMB 3.0.

内存Memory

服务器内存使用情况由三个主要因素驱动:Server memory usage is driven by three main factors:

  • 操作系统开销Operating system overhead

  • Hyper-v 服务每个虚拟机的开销Hyper-V service overhead per virtual machine

  • 分配给每个虚拟机的内存Memory allocated to each virtual machine

对于典型的知识工作者工作负荷,应将运行 x86 Window 8 或 Windows 8.1 的来宾虚拟机指定为大约 512 MB 的内存作为基线。For a typical knowledge worker workload, guest virtual machines running x86 Window 8 or Windows 8.1 should be given ~512 MB of memory as the baseline. 但是,动态内存可能会将来宾虚拟机的内存增加到约 800 MB,具体取决于工作负荷。However, Dynamic Memory will likely increase the guest virtual machine's memory to about 800 MB, depending on the workload. 对于 x64,我们会看到大约 800 MB 开始,增加到 1024 MB。For x64, we see about 800 MB starting, increasing to 1024 MB.

因此,请务必提供足够的服务器内存来满足预期数量的来宾虚拟机所需的内存,并为服务器留出足够的内存量。Therefore, it is important to provide enough server memory to satisfy the memory that is required by the expected number of guest virtual machines, plus allow a sufficient amount of memory for the server.

CPUCPU

为 RD 虚拟化主机服务器规划服务器容量时,每个物理内核的虚拟机数量将取决于工作负荷的性质。When you plan server capacity for an RD Virtualization Host server, the number of virtual machines per physical core will depend on the nature of the workload. 作为起点,合理的做法是计划每个物理核心12个虚拟机,然后运行相应的方案来验证性能和密度。As a starting point, it is reasonable to plan 12 virtual machines per physical core, and then run the appropriate scenarios to validate performance and density. 根据工作负荷的具体情况,可以实现更高的密度。Higher density may be achievable depending on the specifics of the workload.

建议启用超线程,但要确保基于物理内核数而不是逻辑处理器数来计算超额订阅比率。We recommend enabling hyper-threading, but be sure to calculate the oversubscription ratio based on the number of physical cores and not the number of logical processors. 这可确保每个 CPU 的预期性能级别。This ensures the expected level of performance on a per CPU basis.

性能优化Performance optimizations

Dynamic MemoryDynamic Memory

通过平衡内存在运行的虚拟机之间的分布情况,动态内存可以更有效地利用运行 Hyper-v 的服务器的内存资源。Dynamic Memory enables more efficiently utilization of the memory resources of the server running Hyper-V by balancing how memory is distributed between running virtual machines. 可以在虚拟机之间动态分配内存,以响应其变化的工作负荷。Memory can be dynamically reallocated between virtual machines in response to their changing workloads.

动态内存使你可以使用已有的资源增加虚拟机密度,而不会影响性能或可伸缩性。Dynamic Memory enables you to increase virtual machine density with the resources you already have without sacrificing performance or scalability. 这样可以更高效地使用昂贵的服务器硬件资源,从而可以更轻松地管理和降低成本。The result is more efficient use of expensive server hardware resources, which can translate into easier management and lower costs.

在运行 Windows 8 及更高版本并且具有跨多个逻辑处理器的虚拟处理器的来宾操作系统上,请考虑运行与动态内存的操作,以帮助最大程度地减少内存使用量并禁用动态内存以提高计算机拓扑感知的应用程序的性能。On guest operating systems running Windows 8 and above with virtual processors that span multiple logical processors, consider the tradeoff between running with Dynamic Memory to help minimize memory usage and disabling Dynamic Memory to improve the performance of an application that is computer-topology aware. 此类应用程序可以利用拓扑信息来做出计划和内存分配决策。Such an application can leverage the topology information to make scheduling and memory allocation decisions.

分层存储Tiered Storage

RD 虚拟化主机支持用于虚拟桌面池的分层存储。RD Virtualization Host supports tiered storage for virtual desktop pools. 集合中所有共用虚拟桌面共享的物理计算机可以使用小型、高性能的存储解决方案,如镜像固态驱动器 (SSD) 。The physical computer that is shared by all pooled virtual desktops within a collection can use a small-size, high-performance storage solution, such as a mirrored solid-state drive (SSD). 可以将共用虚拟桌面置于更昂贵的传统存储上,如 RAID 1 + 0。The pooled virtual desktops can be placed on less expensive, traditional storage such as RAID 1+0.

物理计算机应放置在 SSD 上,因为共用虚拟机中的大部分读 i/o 都将进入管理操作系统。The physical computer should be placed on a SSD is because most of the read-I/Os from pooled virtual desktops go to the management operating system. 因此,物理计算机使用的存储必须在每秒读取的 i/o 数上保持高得多。Therefore, the storage that is used by the physical computer must sustain much higher read I/Os per second.

此部署配置可确保经济高效地执行性能。This deployment configuration assures cost effective performance where performance is needed. SSD 为较小的磁盘提供更高的性能 (~ 每个集合大约有 20 GB,具体取决于配置) 。The SSD provides higher performance on a smaller size disk (~20 GB per collection, depending on the configuration). 适用于共用虚拟机的传统存储 (RAID 1 + 0) 每个虚拟机使用约 3 GB。Traditional storage for pooled virtual desktops (RAID 1+0) uses about 3 GB per virtual machine.

CSV 缓存CSV cache

Windows Server 2012 和更高版本中的故障转移群集在群集共享卷上 (CSV) 提供缓存。Failover Clustering in Windows Server 2012 and above provides caching on Cluster Shared Volumes (CSV). 这对于共用虚拟桌面集合非常有利,其中大多数读取 i/o 都来自管理操作系统。This is extremely beneficial for pooled virtual desktop collections where the majority of the read I/Os come from the management operating system. CSV 缓存按几个数量级提供更高的性能,因为它会缓存一次读取的块并从系统内存中传递它们,从而减少 i/o。The CSV cache provides higher performance by several orders of magnitude because it caches blocks that are read more than once and delivers them from system memory, which reduces the I/O. 有关 CSV 缓存的详细信息,请参阅 如何启用 Csv 缓存For more info on CSV cache, see How to Enable CSV Cache.

共用虚拟机Pooled virtual desktops

默认情况下,在用户注销后,会将共用虚拟桌面回滚到处于纯洁状态,因此,在上次用户登录后对 Windows 操作系统所做的任何更改都将被放弃。By default, pooled virtual desktops are rolled back to the pristine state after a user signs out, so any changes made to the Windows operating system since the last user sign-in are abandoned.

尽管可以禁用回滚,但它仍然是暂时性的情况,因为虚拟桌面模板的各种更新通常会重新创建共用虚拟机集合。Although it's possible to disable the rollback, it is still a temporary condition because typically a pooled virtual desktop collection is re-created due to various updates to the virtual desktop template.

可以关闭依赖于持久性状态的 Windows 功能和服务。It makes sense to turn off Windows features and services that depend on persistent state. 此外,还可以关闭主要用于非企业方案的服务。Additionally, it makes sense to turn off services that are primarily for non-enterprise scenarios.

在进行广泛的部署之前,应正确评估每个特定服务。Each specific service should be evaluated appropriately prior to any broad deployment. 下面是需要考虑的一些初始事项:The following are some initial things to consider:

服务Service 为什么?Why?
自动更新Auto update 通过重新创建虚拟桌面模板来更新共用虚拟机。Pooled virtual desktops are updated by re-creating the virtual desktop template.
脱机文件Offline files 虚拟桌面始终处于联机状态,并且已从网络上查看。Virtual desktops are always online and connected from a networking point-of-view.
后台碎片整理Background defrag 文件系统更改会在用户注销后被丢弃 (因为回滚到处于纯洁状态或重新创建虚拟桌面模板,这将导致重新创建所有共用虚拟桌面) 。File-system changes are discarded after a user signs off (due to a rollback to the pristine state or re-creating the virtual desktop template, which results in re-creating all pooled virtual desktops).
休眠或睡眠Hibernate or sleep VDI 没有此类概念No such concept for VDI
Bug 检查内存转储Bug check memory dump 没有适用于共用虚拟机的概念。No such concept for pooled virtual desktops. Bug 检查共用虚拟桌面将从处于纯洁状态开始。A bug-check pooled virtual desktop will start from the pristine state.
WLAN 自动配置WLAN autoconfig 没有用于 VDI 的 WiFi 设备接口There is no WiFi device interface for VDI
Windows Media Player 网络共享服务Windows Media Player network sharing service 以用户为中心的服务Consumer centric service
家庭组提供程序Home group provider 以用户为中心的服务Consumer centric service
Internet 连接共享Internet connection sharing 以用户为中心的服务Consumer centric service
Media Center 扩展服务Media Center extended services 以用户为中心的服务Consumer centric service

备注

此列表并不是完整列表,因为任何更改都将影响目标和方案。This list is not meant to be a complete list, because any changes will affect the intended goals and scenarios. 有关详细信息,请参阅 热关闭按下、立即获取 Windows 8 VDI 优化脚本、/pfe!For more info, see Hot off the presses, get it now, the Windows 8 VDI optimization script, courtesy of PFE!.

备注

默认情况下,Windows 8 中的 SuperFetch 处于启用状态。SuperFetch in Windows 8 is enabled by default. 它可识别 VDI,不应禁用。It is VDI-aware and should not be disabled. SuperFetch 可以通过内存页共享进一步减少内存消耗,这对于 VDI 非常有利。SuperFetch can further reduce memory consumption through memory page sharing, which is beneficial for VDI. 运行 Windows 7 的共用虚拟桌面应该被禁用,但对于运行 Windows 7 的个人虚拟桌面,应保持打开状态。Pooled virtual desktops running Windows 7, SuperFetch should be disabled, but for personal virtual desktops running Windows 7, it should be left on.