Linux – virsh slow execution

libvirtlinuxvirtualizationxen

I'm using libvirt with Xen 4. Every time I use the virsh tool, it takes a long time until it's started. I start virsh on the same machine where the Xen hypervisor resides.

Example:

root@xen1:~#: time virsh list
 Id Name                   State
------------------------------------
  0 Domain-0               running


real    0m6.505s
user    0m0.000s
sys     0m0.020s

How can I speed this up? It also happens when I run virsh without arguments. I don't get any errors, even in the log file.

Best Answer

Not really an answer, but I don't have enough rep to just comment on your post.

If you note, the user and sys times are very low. It isn't that the virsh program is taking a lot of resources or needing much actual cpu time. If the real (i.e., wall clock) time is high it's an indicator that your system is very busy with other things and it's taking a while to get to you.

Try running "top" to get a view on what is making your machine so busy. Look especially in the %CPU column to see what the busiest programs are. You can use "<" and ">" to change the sort column. Look also at the %MEM column to see if something is eating up a large amount of your RAM (compare with the RES column, which gives you the resident set size of each process... resident set size is the amount of memory actually in use vs. VIRT which is the total memory that process wants). In the "S" column, if you see a lot of processes in state "D", that indicates that you are I/O bound somewhere. These processes are blocked waiting for I/O.