Trickle – Bandwidth controller in linux

trickle is a portable lightweight userspace bandwidth shaper. It can run in collaborative mode (together with trickled) or in stand alone mode.

Limit the bandwidth for your particular service.

trickle is a userspace bandwidth manager. Currently, trickle supports the shaping of any SOCK_STREAM (see socket(2)) connection established via the socket(2) interface. Furthermore, trickle will not work with statically linked executables, nor with setuid(2) executables. trickle is highly configurable; download and upload rates can be set separately, or in an aggregate fashion.

bandwidth controller

How to install trickle?

To install trickle bandwidth controller in linux Ubuntu, Debian and their derivatives:

# sudo apt-get install trickle
Update EPEL repository for CentOS/RHEL 6.*

# rpm -Uvh

To install trickle on Fedora or CentOS/RHEL

# yum install trickle

Once the installation completed you can verify the options.


The options are as follows:

-h Displays help.

-v Increases the verbosity level (can be specified multiple times).

-V Prints version.

-u rate Limit the upload bandwidth consumption to rate KB/s.

-d rate Limit the download bandwidth consumption to rate KB/s.

-w size Set peak detection window size to size KB. This determines how aggressive trickle is at eliminating bandwidth consump- tion peaks. Lower values will be more aggressive, but may also result in over shaping. The default value (512 KB) is usually sufficient.

-n path Use trickled(8) socket path to communicate with trickled(8).

By default, /tmp/.trickled.sock is used.



# trickle -u 10 -d 20 ncftp

Launch ncftp(1) limiting its upload capacity to 10 KB/s, and download ca-pacity at 20 KB/s.

Basic usage of trickle is as follows. Simply put, you prepend trickle (with rate) in front of the command you are trying to run.

# trickle -d <download-rate> -u <upload-rate> <command>

This will limit the download and upload rate of <command> to specified values (in KBytes/s).

For example, set the maximum upload bandwidth of your scp session to 100 KB/s:

# trickle -u 100 scp backup.tgz [email protected]

If you want, you can set the maximum download speed (e.g., 300 KB/s) of your Firefox browser by creating a custom launcher with the following command.

# trickle -d 300 firefox %u

Finally, trickle can run in a daemon mode, where it can restrict the “aggregate” bandwidth usage of all running programs launched via trickle. To launch trickle as a daemon (i.e., trickled):

# sudo trickled -d 1000

Once the trickled daemon is running in the background, you can launch other programs via trickle. If you launch one program with trickle, its maximum download rate is 1000 KB/s. If you launch another program with trickle, each of them will be rate limited to 500 KB/s, etc.