Finding the Fastest FreeBSD Mirror
24 Oct 2016∞
In the process of installing a new FreeBSD system, I was presented with the question of which mirror to use. Of course, I’m doing a netinstall, so I want the fastest mirror, but how can I find that information?
for i in {1..15}; do
echo -n "ftp${i}.us.freebsd.org: ";
ping -qc1 ftp${i}.us.freebsd.org | tail -1;
done
This was nice, but is ultimately only measuring latency. Most of the servers were between 30-40ms, so nothing conclusive. How about measuring actual transfer speed? To do that, I need a smallish file to download from each one. I found a 25 MB file in the CVS-archive directory that suited this nicely.
for i in {1..15}; do
echo -n "ftp${i}.us.freebsd.org: ";
curl -o /dev/null -m 30 ftp://ftp${i}.us.freebsd.org/pub/FreeBSD/development/CVS-archive/projcvs-projects-archive.tar.gz 2>&1 | \
tail -1 | \
egrep -o '[^[:cntrl:]]+$';
done
The output could be cleaner probably, but all you have to do is check out the 9th column for the duration of the transfer, and whoever scored lowest wins!