Le weblog entièrement nu

Roland, entièrement nu... de temps en temps.

Archives 2011-08

Hack of the day: wondershaper vs. SSH shared connections vs. SCP

We all hate the A in ADSL, but most of us are stuck with it. So there are any number of workarounds that keep our link to the Internet working with a certain amount of perceived fluidity, by way of "traffic shaping". Many of us use wondershaper for that purpose: it's a magic tool that keeps the latency low for interactive traffic by ensuring that the bulk traffic doesn't interfere too much with it.

We all hate the A in ADSL, but most of us are stuck with it. So there are any number of workarounds that make the establishment of new connections to external servers feel faster. Many of us use the SSH "ControlMaster" series of options for that purpose: it's a set of options that allow new connections to a server to reuse an existing one if there is already a connection open (or if there was one until not too long ago), so some time is saved becaused the handshake to establish the connection is only needed once.

Now combine both. SSH to an external server, for instance, work on it. Since it's meant to be an interactive connection, slogin will set some appropriate flags on the IP packets, and wondershaper will give these packets priority over whatever bulk traffic is happening at the time. At some point, you realise you need to transfer a large set of files to there, so you start an SCP transfer. scp, being part of the SSH suite, will reuse the existing connection. Suddenly, your bulk transfer will not only get priority over the other kinds of traffic you might have, but also get intermingled with your keystrokes in the slogin session to the same server. Which means your keystrokes will be delayed significantly, and working interactively becomes even more of a pain. In my case, the priority boost given to the SCP transfer is sometimes enough to cause other unrelated sockets to time out.

After reading some docs, I found my solution. It isn't much, but it's going to change my way of working significantly enough that I'm going to share it anyway.

alias scp='scp -oControlPath=none'

Also, since I use dput extensively, and it invokes scp in many cases without reusing my shell aliases, part of my ~/.dput.cf file reads:

[DEFAULT]
ssh_config_options = ControlPath=none
[…]

This means I keep the advantages of traffic shaping for interactive sessions, but SCP stuff won't interfere anymore, and I can continue working on the server while the new version of the packages that I need to get there are in transit.

One small improvement at a time, progress!

Tags:
Posted jeu. 25 août 2011 16:15:02 CEST
Creative Commons License Sauf indication contraire, le contenu de ce site est mis à disposition sous un contrat Creative Commons.