Wednesday, February 23, 2011

Increase download speed with Aria2 utility

Traditional file downloads are done via an FTP client, a Web browser, or a file-sharing program such as BitTorrent. These means of downloading files will probably never change, but the tools to do the downloading, and how they download, will.

One program that changes how files are downloaded is Aria2. Aria2 is a lightweight multiprotocol and multisource download utility that offers some very compelling reasons for its use over traditional “single thread” downloading such as with an FTP or HTTP client.

Being a multiprotocol client, Aria2 can download via HTTP, via FTP, and via BitTorrent. What makes Aria2 unique is that it can download the same file at the same time utilizing different protocols. It can also open multiple connections to the same, or different, URLs to download the file even faster. By default, Aria2 uses five connections to download a file.

To download a file, use: $ aria2c http://somehost.com/file.zip

If the same file is available from two different places, you can maximize your bandwidth and download it from both, even using different protocols:

$aria2c http://somehost.com/file.zip ftp://otherhost.com/pub/file.zip

To compare speeds, I used curl to download a bzip2 compressed ISO image that weighs in at 200MB:

$ time curl -OL ftp://ftp.ibiblio.org:21//pub/linux/distributions/annvix/releases/ISO/annvix-netinstall-x86_64-3.0-RELEASEr2.iso.tar.bz2



What if you are at work when the new release of your favourite Linux distribution becomes available? Instead of using BitTorrent at work which may go against company usage policies, if you are able to SSH to your home system, you can launch Aria2 under screen and begin the download from there. If you want to download a number of files at once, you can have Aria2 download them sequentially or in parallel; to download files in parallel use:

$ aria2c -Z http://somehost.com/file.zip linuxdistro.torrent

Aria2 allows you to specify the maximum upload rate when downloading torrents. This can be done with the “-u” option, such as “-u40K” would only allow an upload speed of 40KB/s. In fact, Aria2 is a full-featured BitTorrent client with a lot of features such as support for seeding files, downloading files with encryption, and DHT (Distributed Hash Table) support. While some might balk at the use of a command-line client to download files, perhaps cringing at the remembrance of old-school FTP clients, Aria2 is easy to use and easy to script.

No comments:

Post a Comment