After moving our gigantic SVN repo to a new server, we wanted to speed it up. Note that some of these recommendations are peculiar to using the
svn+ssh:// protocol. If you’re serving SVN via Apache or something, you might need very different advice.
Here are all the things we changed on the server to speed up SVN. Note that these are in no particular order… it’s hard to say what will give you the biggest bang for your buck. That said, all of these are pretty cheap gags, so if checkout time is a priority, you might as well try them all!
svnadmin packon your repository as a way of reducing fragmentation of your repository’s shards.
svnservewrapper script, seen below). By default, SVN uses compression level 5 (on a scale from 0 to 9). If you primarily store binary files that don’t benefit from compression, or you have a fast connection, this might be a win. In our case, our server’s CPU was pegged at 100% during a checkout; dropping compression removed the CPU as a bottleneck.
/etc/ssh/sshd_config), disallow “old and busted” ciphers. If your server defaults to 3DES, it’s another security risk plus performance disaster. (It’s quite a bit slower than AES, which typically benefits from hardware acceleration.) You should have a line in the file that looks like this:
If you’re using the
svn:// protocol: Bump the size of SVN’s in-memory cache. It defaults to something like 16 MB, but if you’re running a dedicated server on halfway reasonable hardware, you can allocate way more than that. To do this, you’ll have to be using an
svnserve wrapper. That is, you’ll have to have a custom shell script—something like
/usr/local/bin/svnserve—that modifies the arguments that
ssh+svn-connected users pass to
svnserve. Something like this:
#!/bin/sh # Set the umask so files are group-writable umask 002 # Call the 'real' svnserve, also passing in the default repo location # Use a 4096 MB in-memory cache size, allowing both deltas and full texts of commits to be cached exec /usr/bin/svnserve "$@" --compression 0 --memory-cache-size=4096 --cache-txdeltas yes --cache-fulltexts yes
After making the above changes (except re-sharding) on our
svn+ssh:// server, we were able to go from an average download speed of about 100 kilobytes/second to about 6 megabytes/secon—not bad at all!