After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 668294 - Cache libvirt domain configuration
Cache libvirt domain configuration
Status: RESOLVED FIXED
Product: gnome-boxes
Classification: Applications
Component: general
unspecified
Other All
: Normal normal
: --
Assigned To: GNOME Boxes maintainer(s)
GNOME Boxes maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2012-01-19 18:01 UTC by Zeeshan Ali
Modified: 2016-03-31 14:00 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Cache libvirt domain configuration (4.64 KB, patch)
2012-01-19 18:01 UTC, Zeeshan Ali
reviewed Details | Review
Cache libvirt domain configuration (4.95 KB, patch)
2012-01-24 03:13 UTC, Zeeshan Ali
committed Details | Review

Description Zeeshan Ali 2012-01-19 18:01:05 UTC
No need to keep fetching domain configuration every second.
Comment 1 Zeeshan Ali 2012-01-19 18:01:07 UTC
Created attachment 205648 [details] [review]
Cache libvirt domain configuration

No need to keep fetching domain configuration every second.
Comment 2 Marc-Andre Lureau 2012-01-19 18:08:38 UTC
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.
Comment 3 Zeeshan Ali 2012-01-19 18:17:41 UTC
(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).
Comment 4 Daniel P. Berrange 2012-01-19 18:27:41 UTC
# 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
Comment 5 Marc-Andre Lureau 2012-01-19 18:34:53 UTC
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.
Comment 6 Zeeshan Ali 2012-01-24 03:13:28 UTC
Created attachment 205938 [details] [review]
Cache libvirt domain configuration

No need to keep fetching domain configuration every second.
Comment 7 Marc-Andre Lureau 2012-01-24 11:25:27 UTC
Review of attachment 205938 [details] [review]:

looks good to me (although I would prefer we avoid doing optimization at this point)
Comment 8 Zeeshan Ali 2012-01-24 14:17:18 UTC
Attachment 205938 [details] pushed as 0bbfdd9 - Cache libvirt domain configuration