<div dir="auto">Great investigation.<div dir="auto">Thanks for sharing!<br><br><div data-smartmail="gmail_signature" dir="auto">--<br>  Mykola Ivanets</div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">чт, 11 квіт. 2019, 20:56 користувач Richard W.M. Jones <<a href="mailto:rjones@redhat.com">rjones@redhat.com</a>> пише:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">As I've spent really too long today investigating this, I want to<br>
document this in a public email, even though there's nothing really<br>
that interesting here.  One thing you find from search for VDD 6.7 /<br>
VixDiskLib_QueryAllocatedBlocks issues with Google is that we must be<br>
one of the very few users out there.  And the other thing is that it's<br>
quite broken.<br>
<br>
All testing was done using two baremetal servers connected back to<br>
back through a gigabit ethernet switch.  I used upstream qemu and<br>
nbdkit from git as of today.  I used a single test Fedora guest with a<br>
16G thin provisioned disk with about 1.6G allocated.<br>
<br>
Observations:<br>
<br>
(1) VDDK hangs for a really long time when using the nbdkit --run<br>
    option.<br>
<br>
It specifically hangs for exactly 120 seconds doing:<br>
<br>
  nbdkit: debug: VixDiskLib: Resolve host.<br>
<br>
This seems to be a bug in VDDK, possibly connected with the fact that<br>
we fork after initializing VDDK but before doing the<br>
VixDiskLib_ConnectEx.  I suspect it's something to do with the PID<br>
changing.<br>
<br>
It would be fair to deduct 2 minutes from all timings below.<br>
<br>
(2) VDDK cannot use VixDiskLib_QueryAllocatedBlocks if the disk is<br>
opened for writes.  It fails with this uninformative error:<br>
<br>
  nbdkit: vddk[1]: error: [NFC ERROR] NfcFssrvrProcessErrorMsg: received NFC error 13 from server: NfcFssrvrOpen: Failed to open '[datastore1] Fedora 28/Fedora 28.vmdk'<br>
  nbdkit: vddk[1]: error: [NFC ERROR] NfcFssrvrClientOpen: received unexpected message 4 from server<br>
  nbdkit: vddk[1]: debug: VixDiskLib: Detected DiskLib error 290 (NBD_ERR_GENERIC).<br>
  nbdkit: vddk[1]: debug: VixDiskLib: VixDiskLibQueryBlockList: Fail to start query process. Error 1 (Unknown error) (DiskLib error 290: NBD_ERR_GENERIC) at 543.<br>
  nbdkit: vddk[1]: debug: can_extents: VixDiskLib_QueryAllocatedBlocks test failed, extents support will be disabled: original error: Unknown error<br>
<br>
The last debug statement is from nbdkit itself indicating that because<br>
VixDiskLib_QueryAllocatedBlocks didn't work, extents support is<br>
disabled.<br>
<br>
To work around this you can use nbdkit --readonly.  However I don't<br>
understand why that would be necessary, except perhaps it's just an<br>
undocumented limitation of VDDK.  For all the cases _we_ care about<br>
we're using --readonly, so that's lucky.<br>
<br>
(3) Using nbdkit-noextents-filter and nbdkit-stats-filter we can<br>
nicely measure the benefits of extents:<br>
<br>
With noextents (ie. force full copy):<br>
<br>
  elapsed time: 323.815 s<br>
  read: 8194 ops, 17179869696 bytes, 4.24437e+08 bits/s<br>
<br>
Without noextents (ie. rely on qemu-img skipping sparse bits):<br>
<br>
  elapsed time: 237.41 s<br>
  read: 833 ops, 1734345216 bytes, 5.84423e+07 bits/s<br>
  extents: 70 ops, 135654246400 bytes, 4.57114e+09 bits/s<br>
<br>
Note if you deduct 120 seconds (see point (1) above) from these times<br>
then it goes from 203s -> 117s, about a 40% saving.  We can likely do<br>
better by having > 32 bit requests and qemu not using<br>
NBD_CMD_FLAG_REQ_ONE.<br>
<br>
(4) We can also add nbdkit-readahead-filter in both cases to see if<br>
that helps or not:<br>
<br>
With noextents and readahead:<br>
<br>
  elapsed time: 325.358 s<br>
  read: 265 ops, 17179869184 bytes, 4.22423e+08 bits/s<br>
<br>
As expected the readahead filter reduces the numbers of iops greatly.<br>
But in this back-to-back configuration VDDK requests are relatively<br>
cheap so no time is saved.<br>
<br>
Without noextents, with readahead:<br>
<br>
  elapsed time: 252.608 s<br>
  read: 96 ops, 1927282688 bytes, 6.10363e+07 bits/s<br>
  extents: 70 ops, 135654246400 bytes, 4.29612e+09 bits/s<br>
<br>
Readahead is detrimental in this case, as expected because this filter<br>
works best when reads are purely sequential, and if not it will tend<br>
to prefetch extra data.  Notice that the number of bytes read is<br>
larger here than in the earlier test.<br>
<br>
Rich.<br>
<br>
-- <br>
Richard Jones, Virtualization Group, Red Hat <a href="http://people.redhat.com/~rjones" rel="noreferrer noreferrer" target="_blank">http://people.redhat.com/~rjones</a><br>
Read my programming and virtualization blog: <a href="http://rwmj.wordpress.com" rel="noreferrer noreferrer" target="_blank">http://rwmj.wordpress.com</a><br>
virt-df lists disk usage of guests without needing to install any<br>
software inside the virtual machine.  Supports Linux and Windows.<br>
<a href="http://people.redhat.com/~rjones/virt-df/" rel="noreferrer noreferrer" target="_blank">http://people.redhat.com/~rjones/virt-df/</a><br>
<br>
_______________________________________________<br>
Libguestfs mailing list<br>
<a href="mailto:Libguestfs@redhat.com" target="_blank" rel="noreferrer">Libguestfs@redhat.com</a><br>
<a href="https://www.redhat.com/mailman/listinfo/libguestfs" rel="noreferrer noreferrer" target="_blank">https://www.redhat.com/mailman/listinfo/libguestfs</a><br>
</blockquote></div>