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