linux virtualization

virsh 虚拟机xml信息,留个记录

virsh dumpxml domain

<domain type='kvm' id='12'>
<memory unit='KiB'>8388608</memory>
<currentMemory unit='KiB'>8388608</currentMemory>
<vcpu placement='static'>2</vcpu>
<type arch='x86_64' machine='pc-i440fx-rhel7.0.0'>hvm</type>
<boot dev='hd'/>
<cpu mode='custom' match='exact' check='full'>
<model fallback='forbid'>Haswell-IBRS</model>
<feature policy='disable' name='hle'/>
<feature policy='disable' name='rtm'/>
<feature policy='require' name='hypervisor'/>
<feature policy='require' name='xsaveopt'/>
<clock offset='utc'>
<timer name='rtc' tickpolicy='catchup'/>
<timer name='pit' tickpolicy='delay'/>
<timer name='hpet' present='no'/>
<suspend-to-mem enabled='no'/>
<suspend-to-disk enabled='no'/>
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2'/>
<source file='/ceph2/images/ceph_node3.qcow2'/>
<target dev='vda' bus='virtio'/>
<alias name='virtio-disk0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2' cache='none'/>
<source file='/ceph2/images/ceph_node3_storage.qcow2'/>
<target dev='vdb' bus='virtio'/>
<alias name='virtio-disk1'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
<disk type='file' device='cdrom'>
<driver name='qemu'/>
<target dev='hda' bus='ide'/>
<alias name='ide0-0-0'/>
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
<controller type='usb' index='0' model='ich9-ehci1'>
<alias name='usb'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x7'/>
<controller type='usb' index='0' model='ich9-uhci1'>
<alias name='usb'/>
<master startport='0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0' multifunction='on'/>
<controller type='usb' index='0' model='ich9-uhci2'>
<alias name='usb'/>
<master startport='2'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x1'/>
<controller type='usb' index='0' model='ich9-uhci3'>
<alias name='usb'/>
<master startport='4'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x2'/>
<controller type='pci' index='0' model='pci-root'>
<alias name='pci.0'/>
<controller type='ide' index='0'>
<alias name='ide'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
<controller type='virtio-serial' index='0'>
<alias name='virtio-serial0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
<interface type='bridge'>
<mac address='52:54:00:94:b4:fe'/>
<source bridge='br0'/>
<target dev='vnet2'/>
<model type='virtio'/>
<alias name='net0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
<serial type='pty'>
<source path='/dev/pts/5'/>
<target type='isa-serial' port='0'>
<model name='isa-serial'/>
<alias name='serial0'/>
<console type='pty' tty='/dev/pts/5'>
<source path='/dev/pts/5'/>
<target type='serial' port='0'/>
<alias name='serial0'/>
<channel type='unix'>
<source mode='bind' path='/var/lib/libvirt/qemu/channel/target/domain-12-ceph-node3/org.qemu.guest_agent.0'/>
<target type='virtio' name='org.qemu.guest_agent.0' state='connected'/>
<alias name='channel0'/>
<address type='virtio-serial' controller='0' bus='0' port='1'/>
<input type='tablet' bus='usb'>
<alias name='input0'/>
<address type='usb' bus='0' port='1'/>
<input type='mouse' bus='ps2'>
<alias name='input1'/>
<input type='keyboard' bus='ps2'>
<alias name='input2'/>
<graphics type='vnc' port='5902' autoport='yes' listen=''>
<listen type='address' address=''/>
<model type='cirrus' vram='16384' heads='1' primary='yes'/>
<alias name='video0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
<memballoon model='virtio'>
<alias name='balloon0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
<rng model='virtio'>
<backend model='random'>/dev/urandom</backend>
<alias name='rng0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
<seclabel type='dynamic' model='selinux' relabel='yes'>
<seclabel type='dynamic' model='dac' relabel='yes'>

linux storage tool


man vmstat



  • r: The number of processes waiting for run time.

    r 表示运行队列 (就是说多少个进程真的分配到CPU). 当这个值超过了CPU数目, 就会出现CPU瓶颈.

  • b: The number of processes in uninterruptible sleep.


  • swpd: the amount of virtual memory used.
  • free: the amount of idle memory.
  • buff: the amount of memory used as buffers.
  • cache: the amount of memory used as cache.
  • inact: the amount of inactive memory. (-a option)
  • active: the amount of active memory. (-a option)


  • si: Amount of memory swapped in from disk (/s).
  • so: Amount of memory swapped to disk (/s).


  • bi: Blocks received from a block device (blocks/s).
  • bo: Blocks sent to a block device (blocks/s).


  • in: The number of interrupts per second, including the clock.
  • cs: The number of context switches per second.


  • These are percentages of total CPU time.
  • us: Time spent running non-kernel code. (user time, including nice time)
  • sy: Time spent running kernel code. (system time)
  • id: Time spent idle. Prior to Linux 2.5.41, this includes IO-wait time.
  • wa: Time spent waiting for IO. Prior to Linux 2.5.41, included in idle.

    wa 列显示了IO等待所占用的CPU时间的百分比。这里wa的参考值为30%,如果wa超过30%,说明IO等待严重,这可能是磁盘大量随机访问造成的,也可能磁盘或者磁盘访问控制器的带宽瓶颈造成的(主要是块操作)

  • st: Time stolen from a virtual machine. Prior to Linux 2.6.11, unknown.

linux storage


文章来源: How I Use Iostat and Vmstat for Performance Analysis

考虑到svctm在iostat是不保证准确的. 分析io await相关问题需要和blktrace结合起来分析.

1. Is the I/O heavy?

  • Check the sum of w/s and r/s. The larger, the heavier I/O.
  • Also check %util, the more, the heavier.

    • If it is close to 100, then the I/O is definitely significant. It should be noted that during writing,
    • if the disk is the bottleneck (%util is 100% for a long time), but the applications keep writing, as long as the dirty pages exceeds 30% of memory, the system will block all the write system call, no matter sync or async, and focuses on writing to the disk. Once this occurs, the entire system is slow as hell.
    • check wa in vmstat log.