KVM——磁盘性能

KVM——磁盘性能

我有虚拟机并将物理磁盘连接到它:

<pool type='disk'>
  <name>X</name>
  <uuid>0119698d-d28a-fbc8-6ca3-40c485957e49</uuid>
  <capacity>2000396321280</capacity>
  <allocation>2000388063744</allocation>
  <available>8225280</available>
  <source>
    <device path='/dev/sdb'>
    <freeExtent start='2000388096000' end='2000396321280'/>
    </device>
    <format type='dos'/>
  </source>
  <target>
    <path>/dev</path>
    <permissions>
      <mode>0700</mode>
      <owner>-1</owner>
      <group>-1</group>
    </permissions>
  </target>
</pool>

我的虚拟机有 1 个核心和 2GB 内存。当我复制文件时,传输速率为 7MB/s。

<domain type='kvm' id='7'>
  <name>gfs-6</name>
  <uuid>4061a8b3-860b-3aaa-5014-36c3dbc15ca4</uuid>
  <memory>2097152</memory>
  <currentMemory>2097152</currentMemory>
  <vcpu>1</vcpu>
  <os>
    <type arch='x86_64' machine='pc-0.14'>hvm</type>
    <boot dev='hd'/>
    <bootmenu enable='no'/>
  </os>
  <features>
    <acpi/>
    <pae/>
  </features>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/bin/kvm</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw'/>
      <source file='/opt/vm/gfs-6.img'/>
      <target dev='vda' bus='virtio'/>
      <alias name='virtio-disk0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </disk>
    <disk type='block' device='disk'>
      <driver name='qemu' type='raw'/>
      <source dev='/dev/sdb1'/>
      <target dev='sda' bus='scsi'/>
      <alias name='scsi0-0-0'/>
      <address type='drive' controller='0' bus='0' unit='0'/>
    </disk>
    <controller type='ide' index='0'>
      <alias name='ide0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <controller type='scsi' index='0'>
      <alias name='scsi0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </controller>
    <interface type='bridge'>
      <mac address='52:54:00:2a:56:5e'/>
      <source bridge='br1'/>
      <target dev='vnet1'/>
      <model type='e1000'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
    <serial type='pty'>
      <source path='/dev/pts/2'/>
      <target port='0'/>
      <alias name='serial0'/>
    </serial>
    <console type='pty' tty='/dev/pts/2'>
      <source path='/dev/pts/2'/>
      <target type='serial' port='0'/>
      <alias name='serial0'/>
    </console>
    <input type='mouse' bus='ps2'/>
    <graphics type='vnc' port='5901' autoport='yes'/>
    <video>
      <model type='cirrus' vram='9216' heads='1'/>
      <alias name='video0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
    <memballoon model='virtio'>
      <alias name='balloon0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
    </memballoon>
  </devices>
  <seclabel type='dynamic' model='apparmor'>
    <label>libvirt-4061a8b3-860b-3aaa-5014-36c3dbc15ca4</label>
    <imagelabel>libvirt-4061a8b3-860b-3aaa-5014-36c3dbc15ca4</imagelabel>
  </seclabel>
</domain>

我做错了什么?我希望我的虚拟机有更好的磁盘性能。

答案1

你应该使用虚拟而不是 scsi,它更快。

   <target dev='sda' bus='scsi'/>

你可以找到一些参考资料这里是存储部分

答案2

通过直接访问磁盘,您几乎肯定会获得性能提升。有时,这被称为“半虚拟化”,使用 KVM 时需要使用 virtio 驱动程序(请注意,这也可以用于网络设备)。

详细信息可以在这里找到:http://wiki.libvirt.org/page/Virtio

相关内容