Tuesday, April 19, 2016

High Performance SSH/SCP

http://mirror.internode.on.net/pub/OpenBSD/OpenSSH/portable/
http://www.psc.edu/index.php/hpn-ssh-patches/hpn-14-kitchen-sink-patches/viewcategory/24
Extract OpenSSH:
Change directory in extracted folder and apply patch:
Configure OpenSSH:
Remove old config files to prevent any conflicts:
Compile and install:
Now we have the newest version of OpenSSH installed and patched with the improvements from HPN-SSH; however we still need to make some changes to the /etc/ssh/sshd_config to take advantage of them. Near the bottom of your config file you will see a section for HPN related options; I used the following options from other guides I found:
Linux supports both /proc and sysctl (using alternate forms of the variable names - e.g. net.core.rmem_max) for inspecting and adjusting network tuning parameters. The following is a useful shortcut for inspecting all tcp parameters:
sysctl -a | fgrep tcp
For additional information on kernel variables, look at the documentation included with your kernel source, typically in some location such as /usr/src/linux-<version>/Documentation/networking/ip-sysctl.txt. There is a very good (but slightly out of date) tutorial on network sysctl's at http://ipsysctl-tutorial.frozentux.net/ipsysctl-tutorial.html.
If you would like to have these changes to be preserved across reboots, you can add the tuning commands to your the file /etc/rc.d/rc.local .
echo 1 > /proc/sys/net/ipv4/tcp_moderate_rcvbuf
           echo "8388608"> /proc/sys/net/core/wmem_max 
           echo "8388608"> /proc/sys/net/core/rmem_max 
           echo "4096 87380 8388608" > /proc/sys/net/ipv4/tcp_rmem
           echo "4096 87380 8388608" > /proc/sys/net/ipv4/tcp_wmem
# optimization start
# increase TCP max buffer size setable using setsockopt()
net.ipv4.tcp_rmem = 4096 87380 8388608
net.ipv4.tcp_wmem = 4096 87380 8388608
# increase Linux auto tuning TCP buffer limits
# min, default, and max number of bytes to use
# set max to at least 4MB, or higher if you use very high BDP paths
net.core.rmem_max = 8388608
net.core.wmem_max = 8388608

net.core.netdev_max_backlog = 5000
net.ipv4.tcp_window_scaling = 1
# optimization end

No comments:

Post a Comment