All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH for-8.0] nbd/server: Request TCP_NODELAY
@ 2023-03-27 19:29 Eric Blake
  2023-03-27 22:42 ` Florian Westphal
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Blake @ 2023-03-27 19:29 UTC (permalink / raw)
  To: qemu-devel
  Cc: Florian Westphal, Vladimir Sementsov-Ogievskiy,
	open list:Network Block Dev...

Nagle's algorithm adds latency in order to reduce network packet
overhead on small packets.  But when we are already using corking to
merge smaller packets into transactional requests, the extra delay
from TCP defaults just gets in the way.

For reference, qemu as an NBD client already requests TCP_NODELAY (see
nbd_connect() in nbd/client-connection.c); as does libnbd as a client
[1], and nbdkit as a server [2].

[1] https://gitlab.com/nbdkit/libnbd/-/blob/a48a1142/generator/states-connect.c#L39
[2] https://gitlab.com/nbdkit/nbdkit/-/blob/45b72f5b/server/sockets.c#L430

CC: Florian Westphal <fw@strlen.de>
Signed-off-by: Eric Blake <eblake@redhat.com>
---
 nbd/server.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/nbd/server.c b/nbd/server.c
index a4750e41880..976223860bf 100644
--- a/nbd/server.c
+++ b/nbd/server.c
@@ -2755,6 +2755,7 @@ void nbd_client_new(QIOChannelSocket *sioc,
     }
     client->tlsauthz = g_strdup(tlsauthz);
     client->sioc = sioc;
+    qio_channel_set_delay(QIO_CHANNEL(cioc), false);
     object_ref(OBJECT(client->sioc));
     client->ioc = QIO_CHANNEL(sioc);
     object_ref(OBJECT(client->ioc));

base-commit: e3debd5e7d0ce031356024878a0a18b9d109354a
-- 
2.39.2



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH for-8.0] nbd/server: Request TCP_NODELAY
  2023-03-27 19:29 [PATCH for-8.0] nbd/server: Request TCP_NODELAY Eric Blake
@ 2023-03-27 22:42 ` Florian Westphal
  2023-03-28  0:32   ` Eric Blake
  0 siblings, 1 reply; 3+ messages in thread
From: Florian Westphal @ 2023-03-27 22:42 UTC (permalink / raw)
  To: Eric Blake
  Cc: qemu-devel, Florian Westphal, Vladimir Sementsov-Ogievskiy,
	open list:Network Block Dev...

Eric Blake <eblake@redhat.com> wrote:
> Nagle's algorithm adds latency in order to reduce network packet
> overhead on small packets.  But when we are already using corking to
> merge smaller packets into transactional requests, the extra delay
> from TCP defaults just gets in the way.
> 
> For reference, qemu as an NBD client already requests TCP_NODELAY (see
> nbd_connect() in nbd/client-connection.c); as does libnbd as a client
> [1], and nbdkit as a server [2].
> 
> [1] https://gitlab.com/nbdkit/libnbd/-/blob/a48a1142/generator/states-connect.c#L39
> [2] https://gitlab.com/nbdkit/nbdkit/-/blob/45b72f5b/server/sockets.c#L430
> 
> CC: Florian Westphal <fw@strlen.de>
> Signed-off-by: Eric Blake <eblake@redhat.com>
> ---
>  nbd/server.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/nbd/server.c b/nbd/server.c
> index a4750e41880..976223860bf 100644
> --- a/nbd/server.c
> +++ b/nbd/server.c
> @@ -2755,6 +2755,7 @@ void nbd_client_new(QIOChannelSocket *sioc,
>      }
>      client->tlsauthz = g_strdup(tlsauthz);
>      client->sioc = sioc;
> +    qio_channel_set_delay(QIO_CHANNEL(cioc), false);

../nbd/server.c: In function 'nbd_client_new':
../nbd/server.c:2763:39: error: 'cioc' undeclared (first use in this function); did you mean 'sioc'?

Other than that this looks good to me.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH for-8.0] nbd/server: Request TCP_NODELAY
  2023-03-27 22:42 ` Florian Westphal
@ 2023-03-28  0:32   ` Eric Blake
  0 siblings, 0 replies; 3+ messages in thread
From: Eric Blake @ 2023-03-28  0:32 UTC (permalink / raw)
  To: Florian Westphal
  Cc: qemu-devel, Vladimir Sementsov-Ogievskiy,
	open list:Network Block Dev...

On Tue, Mar 28, 2023 at 12:42:59AM +0200, Florian Westphal wrote:
> Eric Blake <eblake@redhat.com> wrote:
> > Nagle's algorithm adds latency in order to reduce network packet
> > overhead on small packets.  But when we are already using corking to
> > merge smaller packets into transactional requests, the extra delay
> > from TCP defaults just gets in the way.
> > 
> > For reference, qemu as an NBD client already requests TCP_NODELAY (see
> > nbd_connect() in nbd/client-connection.c); as does libnbd as a client
> > [1], and nbdkit as a server [2].
> > 
> > [1] https://gitlab.com/nbdkit/libnbd/-/blob/a48a1142/generator/states-connect.c#L39
> > [2] https://gitlab.com/nbdkit/nbdkit/-/blob/45b72f5b/server/sockets.c#L430
> > 
> > CC: Florian Westphal <fw@strlen.de>
> > Signed-off-by: Eric Blake <eblake@redhat.com>
> > ---
> >  nbd/server.c | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/nbd/server.c b/nbd/server.c
> > index a4750e41880..976223860bf 100644
> > --- a/nbd/server.c
> > +++ b/nbd/server.c
> > @@ -2755,6 +2755,7 @@ void nbd_client_new(QIOChannelSocket *sioc,
> >      }
> >      client->tlsauthz = g_strdup(tlsauthz);
> >      client->sioc = sioc;
> > +    qio_channel_set_delay(QIO_CHANNEL(cioc), false);
> 
> ../nbd/server.c: In function 'nbd_client_new':
> ../nbd/server.c:2763:39: error: 'cioc' undeclared (first use in this function); did you mean 'sioc'?
> 
> Other than that this looks good to me.

Arrgh. Bitten by hitting send before saving the edits in my buffer.
Yes, the obvious fix is needed and intended.

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



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-03-28  0:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-27 19:29 [PATCH for-8.0] nbd/server: Request TCP_NODELAY Eric Blake
2023-03-27 22:42 ` Florian Westphal
2023-03-28  0:32   ` Eric Blake

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.