Because FLOSS is handy, isn’t it?

Bandwidth shaping made easy with Trickle

Posted by isilanes on February 24, 2007

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 Responses to “Bandwidth shaping made easy with Trickle”

  1. sylvainulg said

    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

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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: