[Libguestfs] [PATCH libnbd 3/3] states: Use MSG_MORE to coalesce messages into single packets.

Eric Blake eblake at redhat.com
Mon Jun 10 22:26:44 UTC 2019


On 6/8/19 1:38 PM, Richard W.M. Jones wrote:
> Since we disabled Nagle's algorithm we may send very small packets
> over the wire in some situations where we are calling send(2) from
> states that are responsible for small parts of the protocol.  By
> setting the MSG_MORE flag we can indicate to the kernel that more data
> will follow (usually) immediately and so it can append the data to the
> same outgoing packet.
> 

MSG_MORE is Linux-specific; this probably won't compile on other
platforms. I think you need to gate it behind an agnostic name, and then
use #ifdef MSG_MORE before actually using it.

Also, you tested plaintext modes, but there may also be benefits in
using gnutls_record_cork/uncork in response to a MORE flag (can be a
separate patch from this one).

> Although there is some variability in the test there is a measurable
> benefit.  Using this test:
> 
>   $ time nbdkit memory 100M --run 'examples/threaded-reads-and-writes localhost 10809'
> 
> before applying this patch:
> 
>   real	0m54.151s
>   real	0m54.950s
>   real	0m55.927s
> 
> and after applying this patch:
> 
>   real	0m39.154s
>   real	0m44.249s
>   real	0m44.027s
> 
> Thanks: Eric Blake for suggesting this change.
> ---

The change itself looks reasonable, even if we need to fix things to be
a bit more portable to other platforms.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20190610/51eb02f2/attachment.sig>


More information about the Libguestfs mailing list