Trickle, lightweight userspace bandwidth shaper

Published 07-10-2012 00:00:00

What

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

Before, no limitation:

$ wget 'http://wwww.example.org/somefile'
--2012-07-10 14:46:13--  http://wwww.example.org/somefile

[ ... ]

2012-07-10 14:46:13 (866 KB/s) - `somefile' saved [12485]

After, limited to 40 kbit/s:

$ trickle -v -s -d 40 wget 'http://www.example.org/somefile'
--2012-07-10 14:50:27--  http://wwww.example.org/somefile

[ ... ]

wget: [trickle] avg: 20.8 KB/s; win: 20.8 KB/s
wget: [trickle] avg: 40.13 KB/s; win: 40.13 KB/s
wget: [trickle] avg: 40.12 KB/s; win: 40.12 KB/s
wget: [trickle] avg: 26.68 KB/s; win: 26.68 KB/s
wget: [trickle] avg: 40.1 KB/s; win: 40.1 KB/s
wget: [trickle] avg: 39.95 KB/s; win: 39.95 KB/s

[ ... ]

2012-07-10 14:50:27 (47.1 KB/s) - `somefile' saved [12461]

Install

$ sudo apt-get install trickle

How it works

Tricke uses unix loader (see ld.so(8)) to replace its own version of send and receive.

LD_PRELOAD
       A whitespace-separated list of additional, user-specified, ELF shared libraries to be loaded before all others.  This can be  used  to  selectively  override  functions  in  other  shared
       libraries.  For setuid/setgid ELF binaries, only libraries in the standard search directories that are also setgid will be loaded.