GNOME Bugzilla – Bug 668294
Cache libvirt domain configuration
Last modified: 2016-03-31 14:00:05 UTC
No need to keep fetching domain configuration every second.
Created attachment 205648 [details] [review] Cache libvirt domain configuration No need to keep fetching domain configuration every second.
Review of attachment 205648 [details] [review]: what's the overhead? what's the benefit? there is one drawback with keeping it cached, is that we don't have current version or change notification.
(In reply to comment #2) > Review of attachment 205648 [details] [review]: > > what's the overhead? what's the benefit? there is one drawback with keeping it > cached, is that we don't have current version or change notification. The configuration doesn't exactly change when the domain is active and when configuration changes, its treated a new domain AFAIK (at least VM dispears and re-appears in Boxes UI).
# cat > demo.py <<EOF #!/usr/bin/python from gi.repository import LibvirtGObject; from gi.repository import Gio; from gi.repository import Gtk; LibvirtGObject.init_object_check(None); conn = LibvirtGObject.Connection(uri="qemu:///session") conn.open(None) conn.fetch_domains(None) dom = conn.find_domain_by_name("vm1") for i in range(500): dom.get_config(0).to_xml() EOF # time python demo.py real 0m8.336s user 0m0.375s sys 0m0.035s So approx 16 milliseconds per call to get XML. While in general for libvirt, we say that the fetching of XML is a potentially slow operation, for the QEMU driver it is actually reasonably fast
Thanks Daniel. But if the XML not updated during machine lifetime, and the machine is deleted & created when modified, then I don't see why we should fetch it every sec. either. This shouldn't really affect the user though, since we do it at most on one machine currently.
Created attachment 205938 [details] [review] Cache libvirt domain configuration No need to keep fetching domain configuration every second.
Review of attachment 205938 [details] [review]: looks good to me (although I would prefer we avoid doing optimization at this point)
Attachment 205938 [details] pushed as 0bbfdd9 - Cache libvirt domain configuration