[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Libguestfs] Script to read systemd journal of a guest to find its IP address



On Sat, Jun 14, 2014 at 10:44:13PM +0530, Kashyap Chamarthy wrote:
> On Sat, Jun 14, 2014 at 02:25:59PM +0100, Richard W.M. Jones wrote:
> > Unfortunately the journal_* API calls are rather slow because they
> > have to fetch each single line from the journal.  So there's some work
> > to be done to make that fast.
>  
> Out of curiosity, I just ran the same above invocation w/ `time`. For 5
> occurances, it took about 1m13sec. But this was already 2nd invocation
> (so applinace caching may have kicked in?):
> 
>     $ time sudo ./run ./cat/virt-log -a \
>       /var/lib/libvirt/images/ostack-controller.qcow2 \
>       | grep "dhclient.*bound"
>     Jun 10 17:08:30 dhclient[971] info: bound to 192.162.122.118 -- renewal in 1722 seconds.
>     Jun 10 18:00:48 dhclient[968] info: bound to 192.162.122.118 -- renewal in 1429 seconds.
>     Jun 10 18:18:32 dhclient[970] info: bound to 192.169.142.118 -- renewal in 1391 seconds.
>     Jun 10 18:41:43 dhclient[970] info: bound to 192.169.142.118 -- renewal in 1262 seconds.
>     Jun 10 19:02:46 dhclient[970] info: bound to 192.169.142.118 -- renewal in 1567 seconds.
>     ^C
>     
>     real    1m13.594s
>     user    0m8.272s
>     sys 0m42.631s

Yup, the performance is fairly dismal because of the large number of
small library<->daemon RPCs which happen synchronously.

The libguestfs API OTOH is very good at large uploads and downloads,
as you can see by comparing:

$ time ./run ./cat/virt-log -a ./tests/guests/fedora.img 
[...]
real	0m53.357s
user	0m2.689s
sys	0m40.645s

$ time virt-copy-out -a ./tests/guests/fedora.img /var/log/journal /tmp
real   0m6.755s
user   0m0.117s
sys    0m0.346s

In other words, it is an order of magnitude slower to access the
journal through the API than to download the complete journal to the host!

Luckily this is all relatively easy to fix (without even breaking or
changing the API).  Just needs someone to sit down and write the code.

At the moment I'm concentrating on getting Windows support working
(depends on RHBZ#705799).

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch
http://libguestfs.org/virt-builder.1.html


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]