[Libvir] PATCH: Improve performance on Xen
Richard W.M. Jones
rjones at redhat.com
Fri Aug 10 09:57:50 UTC 2007
Daniel P. Berrange wrote:
> The Xen implementations of
>
> virDomainLookupByID
> virDomainLookupByUUID
> virDomainLookupByName
> virDomainGetOSType
>
> all have sub-optimal performance since they speak to XenD. The lookupXXX
> functions all basically require 3 pieces of info in the end (name,id,uuid).
> They each get given one piece & have to lookup the other piece.
>
> Every running domain has to have an entry in XenStore on /local/domain/N
> where 'N' is the id. Under this location there is always a 'name' field.
> So if we have the id we can efficiently get the name. I just realized that
> the getdomaininfo hypercall struct contains the uuid and id. So for the
> ByID and ByUUID calls we can get all the info we need with a hypercall and
> a read of xenstore. This is very efficient compared to hitting XenD.
>
> As of Xen 3.1.0 hypervisor the flags in the getdomaininfo hypercall struct
> also mark whether the guest is HVM vs paraivrt, so we can also implement
> the GetOSType api with a single hypercall.
>
> That just leaves the ByName impl. The only way I can think of doing this
> is to scan /local/domain/N in xenstore until we find it. I'm going to try
> this, but I'm not convinced it'll be any significantly than talking to XenD.
> I may be surprised though.
>
>
> Any for the 3 improvements I have done, the 'virsh dominfo' call has improved
> when using either ID or UUID:
>
> Create a set of UUIDs & IDs
>
> # for i in `seq 1 500` ; do echo dominfo 73 ; done > ids.txt
> # for i in `seq 1 500` ; do echo dominfo 8f07fe28-753f-2729-d76d-bdbd892f949a ; done > uuids.txt
>
> Now before measurements:
>
> # time ./virsh < ids.txt > /dev/null
> real 0m17.317s
> user 0m0.144s
> sys 0m0.164s
>
> # time ./virsh < uuids.txt > /dev/null
> real 0m14.432s
> user 0m0.236s
> sys 0m0.460s
>
> Against the after measurements:
>
> # time ./virsh < demo.txt > /dev/null
> real 0m0.259s
> user 0m0.100s
> sys 0m0.072s
>
> # time ./virsh < demo.txt > /dev/null
> real 0m0.482s
> user 0m0.324s
> sys 0m0.108s
>
> A pretty good speedup really considering how frequently these calls are
> made if you're monitoring domains frequently.
+1
Rich.
--
Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire, SL4 1TE, United Kingdom. Registered in
England and Wales under Company Registration No. 03798903
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3237 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20070810/79b340a2/attachment-0001.bin>
More information about the libvir-list
mailing list