2777: rbssh is very slow
- New
- Review Board
krzyszto********@blstre****** (Google Code) (Is this you? Claim this profile.) | |
I have working instance of Reviewboard 1.6.13. Everything works except connecting via rbssh i very slow. When I'm creating new review request than I have to wait long time. In auth.log I see that rbssh is opening and closing ssh sessions - about 20 of them. rbssh reviewboard@hostname runs about 40seconds ssh reviewboard@hostname runs in 1sec. The authentication is made with keys.
Yes, rbssh is a disaster. FWIW, replacing /usr/bin/rbssh with the following native wrapper yielded a 5x speed improvement:
!/bin/sh
EXTRA_OPTS="-o UserKnownHostsFile=$HOME/.ssh/known_hosts -o ForwardX11=no -o LogLevel=ERROR"
for k in $HOME/.ssh/id_{dsa,rsa} ; do
test -e "$k" && EXTRA_OPTS="$EXTRA_OPTS -i $k"
doneexec /usr/bin/ssh $EXTRA_OPTS "$@"
Replace the contents of /usr/bin/rbssh with the following:
1 2 3 4 5 6 7 8 | #!/bin/sh EXTRA_OPTS="-o UserKnownHostsFile=$HOME/.ssh/known_hosts -o ForwardX11=no -o LogLevel=ERROR" # see https://en.wikibooks.org/wiki/OpenSSH/Cookbook/Multiplexing EXTRA_OPTS="-o ControlPath=/tmp/master-%r@%h:%p -o ControlMaster=auto -o ControlPersist=10m $EXTRA_OPTS" for k in $HOME/.ssh/id_{dsa,rsa} ; do test -e "$k" && EXTRA_OPTS="$EXTRA_OPTS -i $k" done exec /usr/bin/ssh $EXTRA_OPTS "$@" |
Using native ssh was about 5x faster than the default Python rbssh implementation. Moreover, using the connection multiplexing feature of ssh further sped up things another 5x or so.