[gvfs] afp: Disable Nagle's algorithm
- From: Ross Lagerwall <rossl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gvfs] afp: Disable Nagle's algorithm
- Date: Tue, 15 Jul 2014 21:12:47 +0000 (UTC)
commit 41778e950db34e52a69e382896ede4c0216ef8c6
Author: Ross Lagerwall <rosslagerwall gmail com>
Date: Tue Jul 15 17:38:29 2014 +0100
afp: Disable Nagle's algorithm
Disable Nagle's algorithm for the connection to the server to improve
performance.
Due to the backend doing a write-write-read sequence, the combination of
Nagle's algorithm and TCP delayed ACKs means that the second write is
delayed until the server's delayed ACK timer times out (40ms on Linux).
This results in each request-response taking far too long causing poor
performance.
This patch reduces the time it takes to duplicate a directory of 10000
small files from 21 minutes to 11 seconds.
https://bugzilla.gnome.org/show_bug.cgi?id=733217
daemon/gvfsafpconnection.c | 19 ++++++++++++++++---
1 files changed, 16 insertions(+), 3 deletions(-)
---
diff --git a/daemon/gvfsafpconnection.c b/daemon/gvfsafpconnection.c
index 58291f8..7af4c08 100644
--- a/daemon/gvfsafpconnection.c
+++ b/daemon/gvfsafpconnection.c
@@ -22,6 +22,7 @@
#include <string.h>
#include <glib/gi18n.h>
+#include <gio/gnetworking.h>
#include "gvfsafpconnection.h"
@@ -1772,6 +1773,9 @@ open_thread_func (gpointer user_data)
GVfsAfpConnectionPrivate *priv = conn->priv;
GSocketClient *client;
+ GSocketConnection *connection;
+ GSocket *socket;
+ GError *error = NULL;
guint16 req_id;
gboolean res = FALSE;
@@ -1780,13 +1784,22 @@ open_thread_func (gpointer user_data)
guint pos;
client = g_socket_client_new ();
- priv->stream = G_IO_STREAM (g_socket_client_connect (client, priv->addr, data->cancellable,
- data->error));
+ connection = g_socket_client_connect (client,
+ priv->addr,
+ data->cancellable, data->error);
g_object_unref (client);
- if (!priv->stream)
+ if (!connection)
goto out;
+ socket = g_socket_connection_get_socket (connection);
+ if (!g_socket_set_option (socket, IPPROTO_TCP, TCP_NODELAY, TRUE, &error))
+ {
+ g_warning ("Could not set TCP_NODELAY: %s\n", error->message);
+ g_error_free (error);
+ }
+ priv->stream = G_IO_STREAM (connection);
+
req_id = get_request_id (conn);
res = send_request_sync (g_io_stream_get_output_stream (priv->stream),
DSI_OPEN_SESSION, req_id, 0, 0, NULL,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]