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

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