Blame SOURCES/0010-Set-default-window-size-to-2MB.patch

68eb44
From 0a758095c40ae1b32dc5052a706a16c2d9ac5742 Mon Sep 17 00:00:00 2001
68eb44
From: Salvador Fandino <sfandino@yahoo.com>
68eb44
Date: Mon, 21 Oct 2013 11:58:55 +0200
68eb44
Subject: [PATCH 10/11] Set default window size to 2MB
68eb44
68eb44
The default channel window size used until now was 256KB. This value is
68eb44
too small and results on a bottleneck on real-life networks where
68eb44
round-trip delays can easily reach 300ms.
68eb44
68eb44
The issue was not visible because the configured channel window size
68eb44
was being ignored and a hard-coded value of ~22MB being used instead,
68eb44
but that was fixed on a previous commit.
68eb44
68eb44
This patch just changes the default window size
68eb44
(LIBSSH2_CHANNEL_WINDOW_DEFAULT) to 2MB. It is the same value used by
68eb44
OpenSSH and in our opinion represents a good compromise between memory
68eb44
used and transfer speed.
68eb44
68eb44
Performance tests were run to determine the optimum value. The details
68eb44
and related discussion are available from the following thread on the
68eb44
libssh2 mailing-list:
68eb44
68eb44
http://www.libssh2.org/mail/libssh2-devel-archive-2013-10/0018.shtml
68eb44
http://article.gmane.org/gmane.network.ssh.libssh2.devel/6543
68eb44
68eb44
An excerpt follows:
68eb44
68eb44
"I have been running some transfer test and measuring their speed.
68eb44
68eb44
My setup was composed of a quad-core Linux machine running Ubuntu 13.10
68eb44
x86_64 with a LXC container inside. The data transfers were performed
68eb44
from the container to the host (never crossing through a physical
68eb44
network device).
68eb44
68eb44
Network delays were simulated using the tc tool. And ping was used to
68eb44
verify that they worked as intended during the tests.
68eb44
68eb44
The operation performed was the equivalent to the following ssh command:
68eb44
68eb44
  $ ssh container "dd bs=16K count=8K if=/dev/zero" >/dev/null
68eb44
68eb44
Though, establishment and closing of the SSH connection was excluded
68eb44
from the timings.
68eb44
68eb44
I run the tests several times transferring files of sizes up to 128MB
68eb44
and the results were consistent between runs.
68eb44
68eb44
The results corresponding to the 128MB transfer are available here:
68eb44
68eb44
https://docs.google.com/spreadsheet/ccc?key=0Ao1yRmX6PQQzdG5wSFlrZl9HRWNET3ZyN0hnaGo5ZFE&usp=sharing
68eb44
68eb44
It clearly shows that 256KB is too small as the default window size.
68eb44
Moving to a 512MB generates a great improvement and after the 1MB mark
68eb44
the returns rapidly diminish. Other factors (TCP window size, probably)
68eb44
become more limiting than the channel window size
68eb44
68eb44
For comparison I also performed the same transfers using OpenSSH. Its
68eb44
speed is usually on par with that of libssh2 using a window size of 1MB
68eb44
(even if it uses a 2MB window, maybe it is less aggressive sending the
68eb44
window adjust msgs)."
68eb44
68eb44
Signed-off-by: Salvador Fandino <sfandino@yahoo.com>
68eb44
68eb44
[upstream commit 85a827d1bceb9abd4442f225dd7c65ef5cefdc32]
68eb44
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
68eb44
---
68eb44
 include/libssh2.h |    2 +-
68eb44
 1 files changed, 1 insertions(+), 1 deletions(-)
68eb44
68eb44
diff --git a/include/libssh2.h b/include/libssh2.h
68eb44
index 9b1a6e1..df873fc 100644
68eb44
--- a/include/libssh2.h
68eb44
+++ b/include/libssh2.h
68eb44
@@ -587,7 +587,7 @@ LIBSSH2_API int libssh2_poll(LIBSSH2_POLLFD *fds, unsigned int nfds,
68eb44
                              long timeout);
68eb44
 
68eb44
 /* Channel API */
68eb44
-#define LIBSSH2_CHANNEL_WINDOW_DEFAULT  (256*1024)
68eb44
+#define LIBSSH2_CHANNEL_WINDOW_DEFAULT  (2*1024*1024)
68eb44
 #define LIBSSH2_CHANNEL_PACKET_DEFAULT  32768
68eb44
 #define LIBSSH2_CHANNEL_MINADJUST       1024
68eb44
 
68eb44
-- 
68eb44
1.7.1
68eb44