Search code examples
bandwidthxenhypervisor

Getting the IO count


I am using xen hypervisor. I am trying to get the IO count of the VMs running on top of the xen hypervisor. Can someone suggest me some way or tool to get the IO count ? I tried using xenmon and virt-top. Virt-top doesnt give any value and xenmon always shows 0. Any suggestions to get the number of read or write calls made by a VM or the read and write(Block IO) bandwidth of a particular VM. Thanks !

Regards, Sethu


Solution

  • You can read this directly from sysfs on most systems. You want to open the following directory:

    /sys/devices/xen-backend
    

    And look for directories starting with vbd-

    The nomenclature is:

    vbd-{domain_id}-{vbd_id}/statistics
    

    Inside, you'll find what you need, which is:

    • br_req - Number of block read requests
    • oo_req - Number of 'out of' requests (no room left in list to service any given request)
    • rd_req - Number of read requests
    • rd_sect - Number of sectors read
    • wr_sect - Number of sectors written

    The br_req will be an aggregate count of things like write barriers, aborts, etc.

    Note, for this to work, The kernel has to be told to export Xen attributes via sysfs, but most Xen packages have this enabled. Additionally, the location in sysfs might be different with earlier versions of Xen.