为OpenSSH打补丁提高传输性能HPN-SSH

HPN-SSH(High Performance SSH/SCP)是高性能SSH/SCP,是在原有openssh上打的一组补丁,可以去除openssh上的性能瓶颈。

http://www.psc.edu/index.php/hpn-ssh

打上对应版本的HPN-SSH补丁后,ssh额外的性能:
1, 实时调整buffer大小的能力,从而将文件传输速率提高。
2, 利用多核进行加密/解密,且允许使用不加密的scp数据copy (none cipher),性能更优。

在仅仅使用hpn-ssh作为server或者仅仅作为client的情况下,性能一样可以得到提升。但是在LAN中传送数据,提速是徒劳的,因为传统的ssh已经够快了。

首先修改操作系统的TCP参数:
http://www.psc.edu/index.php/networking/641-tcp-tune
每种操作系统修改方法均有不同,这里以Debian6 64bit为例

/proc/sys/net/ipv4/tcp_rmem

查看ssh版本:

ssh -v

输出:

OpenSSH_5.5p1 Debian-6+squeeze1, OpenSSL 0.9.8o 01 Jun 2010
usage: ssh [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
[-D [bind_address:]port] [-e escape_char] [-F configfile]
[-I pkcs11] [-i identity_file]
[-L [bind_address:]port:host:hostport]
[-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port]
[-R [bind_address:]port:host:hostport] [-S ctl_path]
[-W host:port] [-w local_tun[:remote_tun]]
[user@]hostname [command]

这里的OpenSSH版本是5.5p1

http://www.psc.edu/index.php/hpn-ssh
在这个页面找到对应的补丁包下载地址

OpenSSH_5.5p1对应的补丁包下载地址:
http://www.psc.edu/index.php/component/remository/HPN-SSH/OpenSSH-5.5-patches/OpenSSH-5.5-Kitchen-Sink-patch/
http://www.psc.edu/index.php/component/remository/func-startdown/708/
http://www.psc.edu/index.php/component/remository/func-download/708/chk,fbc8716cf110a440018071fee8f93f9c/no_html,1/
http://www.psc.edu/index.php/component/remository/func-download/708/chk,fbc8716cf110a440018071fee8f93f9c/no_html,1/openssh-5.5p1-hpnssh13v9.diff

apt-get install build-essential devscripts fakeroot

cd /tmp
wget http://www.psc.edu/index.php/component/remository/func-download/708/chk,fbc8716cf110a440018071fee8f93f9c/no_html,1/openssh-5.5p1-hpnssh13v9.diff.gz
zcat ./openssh-5.5p1-hpnssh13v9.diff.gz | patch

上一篇: