On Sat, May 17, 2025 at 11:11:51PM +0300, Nir Soffer wrote:
> On both macOS and Linux, the default send buffer size is too small causing 
> poor
> performance when reading and writing to qemu-nbd. A simple way to experience
> this is to compare TCP and unix sockets, showing that TCP socket is much
> faster. Programs like nbdcopy partly mitigate this by using multiple NBD
> connections.
> 
> On macOS the default send buffer size is 8192 bytes. Increasing the send 
> buffer
> size to 2 MiB shows up to *12.6 times higher throughput* and lower cpu usage.
> 
> On Linux the default and maximum buffer size is 212992 bytes. Increasing the
> send buffer size to 2 MiB shows up to *2.7 times higher throughput* and lower
> cpu usage. On older machine we see very little improvement, up to 1.03 times
> higher throughput.
> 
> We likely have the same issue on other platforms. It should be easy to enable
> this change for more platform by defining UNIX_STREAM_SOCKET_SEND_BUFFER_SIZE.

Thanks; I'm staging this through my NBD tree.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.
Virtualization:  qemu.org | libguestfs.org


Reply via email to