diff options
author | Stefan Hajnoczi <stefanha@redhat.com> | 2013-02-27 15:05:47 +0100 |
---|---|---|
committer | Stefan Hajnoczi <stefanha@redhat.com> | 2013-03-25 11:13:09 +0100 |
commit | 20048d0a12b1080f688ff9b82696134df1aa3607 (patch) | |
tree | c28b096d6126a8a1d6918d80f903338da4a4fa4d /net/socket.c | |
parent | fe6344a05fba26e16863fefcb823242e579b0991 (diff) | |
download | qemu-20048d0a12b1080f688ff9b82696134df1aa3607.zip qemu-20048d0a12b1080f688ff9b82696134df1aa3607.tar.gz qemu-20048d0a12b1080f688ff9b82696134df1aa3607.tar.bz2 |
net: use socket_set_nodelay() for -netdev socket
Reduce -netdev socket latency by disabling the Nagle algorithm on
SOCK_STREAM sockets in net/socket.c. Since we are tunelling Ethernet
over TCP we shouldn't artificially delay outgoing packets, let the guest
decide packet scheduling.
I already get sub-millisecond -netdev socket ping times on localhost, so
there was no measurable difference in my testing. This won't hurt
though and may improve remote socket performance.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Benoit Canet <benoit@irqsave.net>
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
Diffstat (limited to 'net/socket.c')
-rw-r--r-- | net/socket.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/net/socket.c b/net/socket.c index d8b35a2..b0c83e0 100644 --- a/net/socket.c +++ b/net/socket.c @@ -438,6 +438,9 @@ static NetSocketState *net_socket_fd_init_stream(NetClientState *peer, s->fd = fd; s->listen_fd = -1; + /* Disable Nagle algorithm on TCP sockets to reduce latency */ + socket_set_nodelay(fd); + if (is_connected) { net_socket_connect(s); } else { |