[Libguestfs] [PATCH nbdkit BROKEN 0/2] vddk: Support multi-conn, but only open one VDDK connection

Richard W.M. Jones rjones at redhat.com
Thu Dec 16 10:31:53 UTC 2021


This is broken as noted in the first commit message.  I'm only posting
it to document and archive the approach.

We would like to enable multi-conn in the VDDK plugin for its
potential performance benefits, and also to avoid the hack that we had
to add to virt-v2v:

https://github.com/libguestfs/virt-v2v/commit/bb0e698360470cb4ff5992e8e01a3165f56fe41e

One way I thought of doing this would be to advertise multi-conn, but
internally in the plugin only ever open a single VDDK connection.
Multiple calls to .open would open the VDDK connection on the first
call and increment a counter in other cases.  Multiple calls to .close
would close the connection only on the last close.

However it doesn't actually work.  For some reason our old enemy
QueryAllocatedBlocks (QAB) suddenly becomes many times (about 18-20
times) slower when you do this.  Of course it's closed source so we
can never work out why, but my speculation is that QAB has a mutex
that prevents it from overlapping with any other call, and that it
only works well when called linearly across the disk.  When nbdcopy
sees multi-conn it will launch 4 threads reading in parallel across
different offsets which would break both of these assumptions.

I observed similar huge slowdowns (7x) in QAB when opening multiple
read-only connections to the same disk using the current code.

Anyway, for whatever reason it doesn't work, so this is just for
archiving.

Rich.






More information about the Libguestfs mailing list