On several occasions I noticed that when performing a cabal update that the
index was being downloaded at the rate of plus min 300 KB/s. Finally I got around to do
something about this. I’ve set up a caching server located in Utrecht, The
Netherlands. It is a caching proxy for the hackage repository. If you want to
use it, add the following to your ~/.cabal/config file. (Or equivalent on
Windows.)
Be sure to comment out the already existing remote-repo. Otherwise, cabal will
download both indexes and merge them, and we don’t want this.
The funny bit
Apparently this only helps if your machine is fast enough to process the index
(untarring and all extra administration cabal performs).
Plainly getting the file from the cache:
1234
> wget http://spockz.nl:12080/packages/archive/00-index.tar.gz
Saving to: 00-index.tar.gz
100%[======================================>] 3.394.821 10,9M/s in 0,3s
2011-11-13 00:12:35 (10,9 MB/s) - 00-index.tar.gz saved [3394821/3394821]
And running cabal update with my cache as source:
1
cabal update -v3 7,50s user 0,21s system 99% cpu 7,736 total
And then finally, with the original repository:
1
cabal update -v3 7,57s user 0,25s system 28% cpu 27,372 total
So here we see that the user time is roughly the same but you spent almost three
times more seconds waiting for your coffee to get cold. Any further speed
improvements for cabal update will probably require optimalisation of the code.
The caching server
I’m using Varnish
to cache the request to hackage. And here is my config file. Please shoot if you
see any improvements.