On Mon, Mar 8, 2021 at 11:50 AM Richard W.M. Jones <rjones@redhat.com> wrote:
On Mon, Mar 08, 2021 at 01:26:44AM +0200, Nir Soffer wrote:
$ strace -f -c ../copy/nbdcopy --sparse=1048576 --request-size=1048576 --requests=16 --connections=1 $SRC $DST strace: Process 1094611 attached strace: Process 1094612 attached strace: Process 1094613 attached strace: Process 1094614 attached strace: Process 1094615 attached strace: Process 1094616 attached strace: Process 1094617 attached strace: Process 1094618 attached strace: Process 1094619 attached strace: Process 1094620 attached strace: Process 1094621 attached strace: Process 1094622 attached strace: Process 1094623 attached strace: Process 1094641 attached
(Not sure why we start so many threads with --connections=1 - bug?)
I'm not sure of the exact command, so I used:
$ ./run nbdcopy --sparse=1048576 --request-size=1048576 --requests=16 --connections=1 -- [ qemu-nbd -f qcow2 -t ~/fedora-32.qcow2 ] [ nbdkit memory 6G ]
Temporarily adding -v shows:
nbdcopy: src: nbd_ops "qemu-nbd" nbdcopy: src: size=6442450944 nbdcopy: dst: nbd_ops "nbdkit" nbdcopy: dst: size=6442450944 nbdcopy: connections=1 requests=16 threads=1 synchronous=false ^^^^^^^^^
Many threads were created but they all appeared to be associated with the ./run script, qemu-nbd and nbdkit. nbdcopy should only create one worker thread in this scenario.
Right, I was testing the run script instead of .libs/xxx. When running the actual executable we see: $ strace -f -c ../copy/.libs/nbdcopy --flush --sparse=1048576 --request-size=1048576 --requests=16 --connections=1 $SRC $DST strace: Process 1142801 attached % time seconds usecs/call calls errors syscall ------ ----------- ----------- --------- --------- ---------------- 59.70 0.914059 914059 1 futex 18.90 0.289297 17 16768 1 recvfrom 17.99 0.275497 32 8380 4 sendto 2.73 0.041852 4 8921 poll 0.50 0.007616 230 33 madvise ... $ strace -c .libs/copy-libev $SRC $DST % time seconds usecs/call calls errors syscall ------ ----------- ----------- --------- --------- ---------------- 50.25 0.297711 19 15446 1 recvfrom 39.81 0.235824 34 6863 sendto 7.69 0.045573 5 8911 epoll_wait 1.04 0.006132 4 1317 epoll_ctl 0.42 0.002478 24 103 mmap ... Why do we use the run script?