Monthly Archives: October 2007

How to make Gentoo’s CVS access suck less …

This post started out as a major rant against CVS and how it sucks to be using it from Europe and how all those round trips in the protocol make even just bumping a single ebuild a tedious task that I have never been able to do in under 4~5 minutes.

But no! I shall not lower myself to this level and instead write a praise for the OpenSSH folks who through their l33t coding skills give us the opportunity to improve CVS for free :D

The problem : the CVS protocol sucks because for each file/directory you want to update, CVS will open a new SSH connection to send its command. The SSH protocol does not really help with that since creating a new connection brings a lot of overhead.

The solution : use the OpenSSH ControlMaster option to tell it to use a single connection that stays open (somewhat like Keep-alive in HTTP) and that will be used to create new “sub-connections” that are much cheaper.

“How?” you ask me. Well, here’s how.

  1. Add this to your ~/.ssh/config
    Host *
    ControlMaster auto
    ControlPath ~/.ssh/master-%r@%h:%p

  2. After running ssh-agent, run the following command :
    ssh -M -N -f login@cvs.gentoo.org

  3. Enjoy a 3x speed-up like I did! For those that doubt it, here’s how I measured
    cd gentoo-x86/profiles
    find &> /dev/null
    time cvs up -dP
    ssh -M -N -f login@cvs.gentoo.org
    time cvs up -dP

I’d like to give a big “Thank You” to Robin who suggested I try those steps and helped me set them up. Here’s to hoping it helps other fellow devs ;)

References

  • http://www.linux.com/articles/54498 for the configuration file
  • http://gcc.gnu.org/wiki/SSH%20connection%20caching for a simple explanation of the command line options