summary refs log tree commit diff stats
path: root/util/vhost-user-server.c
diff options
context:
space:
mode:
authorFlorian Westphal <fw@strlen.de>2023-03-24 11:47:20 +0100
committerKevin Wolf <kwolf@redhat.com>2023-03-27 13:44:29 +0200
commitbd2cd4a441ded163b62371790876f28a9b834317 (patch)
tree0dd59ed051aac73435ed6b2a4a09f23506b83dc7 /util/vhost-user-server.c
parente3debd5e7d0ce031356024878a0a18b9d109354a (diff)
downloadfocaccia-qemu-bd2cd4a441ded163b62371790876f28a9b834317.tar.gz
focaccia-qemu-bd2cd4a441ded163b62371790876f28a9b834317.zip
nbd/server: push pending frames after sending reply
qemu-nbd doesn't set TCP_NODELAY on the tcp socket.

Kernel waits for more data and avoids transmission of small packets.
Without TLS this is barely noticeable, but with TLS this really shows.

Booting a VM via qemu-nbd on localhost (with tls) takes more than
2 minutes on my system.  tcpdump shows frequent wait periods, where no
packets get sent for a 40ms period.

Add explicit (un)corking when processing (and responding to) requests.
"TCP_CORK, &zero" after earlier "CORK, &one" will flush pending data.

VM Boot time:
main:    no tls:  23s, with tls: 2m45s
patched: no tls:  14s, with tls: 15s

VM Boot time, qemu-nbd via network (same lan):
main:    no tls:  18s, with tls: 1m50s
patched: no tls:  17s, with tls: 18s

Future optimization: if we could detect if there is another pending
request we could defer the uncork operation because more data would be
appended.

Signed-off-by: Florian Westphal <fw@strlen.de>
Message-Id: <20230324104720.2498-1-fw@strlen.de>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'util/vhost-user-server.c')
0 files changed, 0 insertions, 0 deletions