Bandwidth shaping made easy with Trickle

I have recently downgraded the bandwidth of my internet connection, switching to a flat rate (previously I had a monthly traffic limit, albeit with a wider bandwidth). This means that now I can download to my heart’s content, but it also means that when doing things like upgrading my Debian OS with aptitude, it eats all of my bandwidth, and I can barely do anything else in the Internet, untill all packages are upgraded.

A similar effect can happen when using p2p software like aMule or KTorrent, but these programs have options to throttle down their bandwidth usage (e.g., set maximum download and upload rates).

When dealing with programs that do not have this facility, we can always resort to Trickle, which can set arbitrary limits to any program it is used with. For example:

% trickle -d 20 aptitude upgrade

will run aptitude upgrade as usual, but with a maximum download rate of 20 kB/s. Note: aptitude usually spawns two processes (downloads files in couples, not one by one), and the limit imposed by trickle is applied to each process, so the used download bandwidth will be double that specified in the command line. Or, in other words, if you want aptitude to use X bandwidth, execute:

% trickle -d X/2 aptitude upgrade

2 Comments »

  1. sylvainulg said,

    May 18, 2007 @ 9:54 am

    hmm … nice thing to have. I think i shall use it more often than rsync -bwlimit ^_^

    btw, does it allow one to limit bandwidth a posteriori just like you can “renice -p 12345” ? can you “retrickle -p 12345 -bw 10K” ?

  2. Iñaki Silanes said,

    May 18, 2007 @ 10:19 am

    AFAIK, you can’t. A dirty solution is to stop a transfer, and continue it with trickle… but sometimes it might be impossible/uncomfortable.

RSS feed for comments on this post · TrackBack URI

Leave a Comment