sql-server – 虽然Windows处于空闲状态,但KVM top在Windows7 guest虚拟机的主机上显示高CPU负载

前端之家收集整理的这篇文章主要介绍了sql-server – 虽然Windows处于空闲状态,但KVM top在Windows7 guest虚拟机的主机上显示高CPU负载前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我们有一个虚拟化环境,实际上有4个虚拟机(2 x linux,1 x w2k3,1 x win7).
在主机系统(Debian Jessie)中,对于win7 guest虚拟机的qemu进程,顶部始终显示30-70%(或更多)的cpu负载,即使guest虚拟机中的taskmanager处于零cpu负载.
top - 11:12:08 up 6 days,1:47,1 user,load average: 0,70,62,55
Tasks: 216 total,2 running,214 sleeping,0 stopped,0 zombie
%cpu(s):  5,0 us,3,7 sy,0 ni,91,3 id,0 wa,0 hi,0 si,0 st
KiB Mem:  24776900 total,21591188 used,3185712 free,122680 buffers
KiB Swap:  3905532 total,60748 used,3844784 free.   399364 cached Mem

  PID USER      PR  NI    VIRT    RES    SHR S  %cpu %MEM     TIME+ COMMAND                              
11138 libvirt+  20   0 10,804g 8,243g  18536 R  70,1 34,9   2137:30 qemu-system-x86                      
12134 libvirt+  20   0 7309216 6,046g  18792 S   3,7 25,6 139:13.88 qemu-system-x86                      
12055 libvirt+  20   0 8900940 4,057g  18500 S   2,3 17,2 109:41.87 qemu-system-x86                      
12041 libvirt+  20   0 2956240 1,388g  18292 S   2,0  5,9  61:38.55 qemu-system-x86                      
 5569 root      20   0 1007924  23456  11012 S   1,0  0,1   1:16.86 libvirtd

在guest虚拟机内部运行MSsql 2008 R2 Express.为此设置Traceflag -T8038(根据proxmox performance tweaks).此外,平板电脑设备已从配置中删除,并且客户端内的虚拟设备已禁用(因为我不知道如何在VM配置中禁用它).
此外,它还运行Pervasive sql 8服务器来触发旧的btrieve数据库.

奇怪的是,如果我从guest虚拟机中完全删除所有NIC,则顶部的cpu负载会降至足够的水平(1-3%).实际上,作为一个NIC我通过其中一个物理网卡(Intel I350).但是虚拟化NIC的行为是相同的.
所有测试都没有连接任何客户端.

实际访客配置:

<domain type='kvm'>
  <name>win7</name>
  <uuid>4b62c825-07ce-49b9-be8c-63f1f51ec28c</uuid>
  <memory unit='KiB'>8388608</memory>
  <currentMemory unit='KiB'>8388608</currentMemory>
  <vcpu placement='static'>2</vcpu>
  <os>
    <type arch='x86_64' machine='pc-i440fx-2.1'>hvm</type>
  </os>
  <features>
    <acpi/>
    <apic/>
    <hyperv>
      <relaxed state='on'/>
      <vapic state='on'/>
      <spinlocks state='on' retries='8191'/>
    </hyperv>
  </features>
  <cpu mode='host-model'>
    <model fallback='allow'/>
    <topology sockets='1' cores='2' threads='1'/>
  </cpu>
  <clock offset='localtime'>
    <timer name='rtc' tickpolicy='catchup'/>
    <timer name='pit' tickpolicy='delay'/>
    <timer name='hpet' present='no'/>
    <timer name='hypervclock' present='yes'/>
  </clock>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <pm>
    <suspend-to-mem enabled='no'/>
    <suspend-to-disk enabled='no'/>
  </pm>
  <devices>
    <emulator>/usr/bin/kvm</emulator>
    <disk type='block' device='disk'>
      <driver name='qemu' type='raw' cache='none' io='native'/>
      <source dev='/dev/vg_vm/lv_win7Pro'/>
      <target dev='vda' bus='virtio'/>
      <boot order='1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <target dev='hdb' bus='ide'/>
      <readonly/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>
    <controller type='usb' index='0' model='ich9-ehci1'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x7'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci1'>
      <master startport='0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0' multifunction='on'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci2'>
      <master startport='2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x1'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci3'>
      <master startport='4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x2'/>
    </controller>
    <controller type='pci' index='0' model='pci-root'/>
    <controller type='ide' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <controller type='virtio-serial' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
    </controller>
    <serial type='pty'>
      <target port='0'/>
    </serial>
    <console type='pty'>
      <target type='serial' port='0'/>
    </console>
    <channel type='spicevmc'>
      <target type='virtio' name='com.redhat.spice.0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>
    <input type='mouse' bus='ps2'/>
    <input type='keyboard' bus='ps2'/>
    <graphics type='vnc' port='-1' autoport='yes'/>
    <video>
      <model type='qxl' ram='65536' vram='65536' heads='1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <source>
        <address domain='0x0000' bus='0x07' slot='0x00' function='0x1'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
    </hostdev>
    <memballoon model='virtio'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </memballoon>
  </devices>
</domain>

什么可能导致这个以及如何改进?

解决方法

我过去遇到过类似的问题,其中IRQ攻击客户端,主机负载很高.您必须隔离guest虚拟机中攻击cpu内容. Prime候选者是MSsql实例和hal.dll库.

要进行调试,请执行以下步骤:

>停止你的MSsql实例.主机负载是否减少?如果是这样,你找到了罪魁祸首.关键是MSsql使用高定时器频率(1ms),即使在空闲时也是如此.在裸机上这不是一个问题(系统将只使用更多的瓦特),但在虚拟化的一个可能是一个问题.如果可能,您应该确定Windows正在使用的计时器源,并尝试在可用的源之间切换.作为一种变通方法,存在一个补丁,用于将时钟定时器中断提高到12ms.有关更多信息,请参阅herehere.
>如果点n.1没有带来任何好处,那么问题可能与HAL有关.我看到你正在使用两个vcpu;尝试使用单个vcpu启动VM.这有什么改变吗?如果不是,请执行Windows硬件选项卡的屏幕截图(展开HAL节点)并在此处报告.

编辑:好的,似乎MSsql和HAL也不是导致主机负载的根本原因.继续第二个调试阶段:

>停止虚拟机并从其定义中删除所有USB设备.重启机器并检查主机负载:它改变了吗?>如果不是,请使用powertop实用程序监控主机的cpu活动.在这里,您应该看到最常用的软件例程/中断.在30秒内运行并在此处报告.

猜你在找的MsSQL相关文章