配置虚拟机的虚拟CPU,也称为vCPU,是最容易的任务。 vCPU和物理CPU内核之间没有一对一的对应关系。相反,当vCPU要执行任务时,一个vCPU就是放置在物理CPU内核队列中的一个逻辑线程。队列中的请求越多,执行线程就越久。由于CPU访问延迟,通常推荐配置虚拟机时,vCPU要比实际所需少一点。虚拟机自身完全察觉不到延迟,因此这仅能从虚拟机外部去监控。例如,高CPU延迟不会引发SQL Server里SOS_SCHEDULER_YIELD高等待统计信息。最新一代的管理程序目前支持每台虚拟机可以配置大量vCPU。Windows Server 2012支持32个vCPU。尽量确保每个物理CPU内核不超过2个vCPU。
就像Windows,SQL Server也能安装到虚拟机,并能成功运行,没有任何特定的调校或配置。然而,你或许想考虑配置SQL Server的Max Server Memory,尽管你可能在调校好的物理机上做这件事情。在SQL Server 2012中,这项设置现在把工作极限放在SQL Server使用的全部内存上,然而之前的版本中,这仅仅影响缓冲池的大小。在标准或企业版的SQL Server 2012或企业版之前版本上,Hyper-V配置中,Max Server Memory要比Maximum RAM值低大约2GB,以便SQL Server能够增加比分配的内存更多的内存使用。
select (m.total_physical_memory_kb /1024)
as 'Physical Memory (MB)',
convert(decimal(3,1),(convert(decimal(10,1),m.available_physical_memory_kb / 1024)
/ convert(decimal(10,1),m.total_physical_memory_kb / 1024)) * 100)
as 'Available Memory as % of Physical Memory'
from sys.dm_os_sys_memory m,sys.dm_os_sys_info i
select convert(decimal(10,1),(convert(decimal(10,1),i.committed_target_kb / 1024)
/convert(decimal(10,1),m.total_physical_memory_kb / 1024))
* 100) as 'Committed Target as % of Physical Memory',
convert(decimal(3,1),(convert(decimal(10,1),i.committed_kb / 1024)
/convert(decimal(10,1),m.total_physical_memory_kb / 1024))
* 100) as 'Total Committed as % of Physical Memory'
From sys.dm_os_sys_memory m, sys.dm_os_sys_info i
? Percentage of physical CPU utilization
? Percentage of physical memory utilization
? Any CPU latency experienced by the hypervisor (VMware calls this CPU Ready Time)
? Total amount of memory currently allocated to the host’s virtual servers
? Physical storage MB/s and IOPS that the hypervisor is using
? Physical storage read and write latency times
? Percentage of HBA bandwidth utilization
? Percentage of NIC bandwidth utilization
虚拟机(Virtual Server):
? % logical CPU utilization
? Total physical memory (MB)
? Available memory (MB)
? Logical storage MB/s and IOPS that the operating system is using
? Logical storage read and write latency times
SQL Server实例:
? SQL Server fi le I/O latencies from sys.dm_io_virtual_file_stats
? Committed and Target Committed Memory values from sys.dm_os_sys_info
? Batch requests/sec as a benchmark of server activity levels