Trickle is a portable application bandwidth shaper lightweight. It can run in collaborative mode “together with trickled” or in stand alone mode. It is a great tool command line based. trickle can be limit application bandwidth, upload or download speed, and prioritizing daemons. You can use Trickle to cap application speeds per application, download, filetype or globally.
You have limited bandwidth, which you need to share with some other machines or just between different services on you machine. So you need a tool that can shape, control and manage the bandwidth so everybody can make a responsible use of it.
Here is where trickle comes in handy. Install trickle.
For Centos and Fedora
$ yum install trickle
For Debian and Ubuntu
$ sudo apt-get install trickle
The syntax is: trickle [-h] [-v] [-V] [-s] [-d rate] [-u rate] [-w length] [-t time] [-l length] [-n path] command man trickle for more details.
# Limit the download bandwidth at 100Kbps for wget
$ trickle -d 100 wget http://cdimage.ubuntu.com/daily/current/precise-alternate-i386.iso
# Start Firefox limiting its download to 25 KB/s and upload badwidth to 15 KB/s
$ trickle -d 25 -u 15 firefox
# Limit to 300kpbs the download bandwidth for a system update via apt-get:
$ trickle -d 300 apt-get upgrade
Daemon Collaborative-Mode Example:
To start trickle as daemon mode and limit all the bandwidth, use the command trickled via sudo or root with the following syntax:
$ trickled -d download-bandwidth -u upload-bandwidth command
# Start the daemon and limit upload 100Kbps and download at 200Kbps
$ trickled -d 200 -u 100
(trickle daemon above will limit the total bandwidth available to all programs run via trickle to 200 KB/s both up and down. if you run a single program using trickle, it can consume 200 Kbps. Two programs can each consume 100 Kbps)
All the configuration should be done in the file: /etc/trickled.conf Here is an example of that file:
Priority = 1
Time-Smoothing = 0.1
Length-Smoothing = 1
Priority = 2
Time-Smoothing = 5
Length-Smoothing = 10
Priority = 8
Priority: Sets the priority a session have the lowest the priority number is, the highest priority the protocol have.
Length-Smoothing: Set smoothing length to length KB. The smoothing length is a fallback of the smoothing time. If trickled cannot meet the requested smoothing time, it will instead fall back on sending length KB of data. The default value is 10 KB.
Time-Smoothing: Set smoothing time to seconds s. The smoothing time determines with what intervals trickled will try to let the application transcieve data. Smaller values will result in a more continuous (smooth) session, while larger values may produce bursts in the sending and receiving data. Smaller values (0.1 – 1 s) are ideal for interactive applications while slightly larger values (1 – 10 s) are better for applications that need bulk transfer.
This parameter is customizable on a per-application basis via trickled.conf(5). The default value is 5 s. Remember that trickle only works for TCP connections and not for UDP ones.