March 11, 2012

Using Trickle to Control Bandwidth Use in Any Program

There are a number of reasons why you would want to control how much bandwidth any given program is able to use. This can be done in a couple different ways, including options right with in the software, or through a software or hardware firewall. A great little program for managing bandwidth use is Trickle. Trickle runs completely in userspace, which means we don't need to mess with a firewall, or even need root access.

If you're on Ubuntu/Debian you should be able to install Trickle using



sudo apt-get install trickle

Now that you've got Trickle installed just use it before any network command to limit its bandwidth. Quite self-explanatory -u specifies upload and -d download.



trickle -u 25 -d 100 myCommand

The reason I first started using Trickle was so I could use Rsync and SCP to copy/backup files on my computer without negatively affecting the speed of my Internet connection. I have a fairly limited upload speed and this is an example of how I would limit the upload speed to 100 KB/s when backup up a folder with Rsync. Please note that when using Trickle with Rsync you have to use the -e option.



trickle -a -e "trickle -u 100 ssh" myFiles [email protected]:/home/matthew/backups/

It is even easier using Trickle with SCP where all you would need to do is use:



trickle -u 100 scp myFile.zip [email protected]:/home/matthew/backups/
Tags: Trickle Linux Rsync Ubuntu