Control your bandwidth with Trickle

Apps

Ever had one of those situations where you pause for a moment, think back to a time long ago, and say, I wish I knew this back then? Even if you haven’t, Trickle will trigger many such memories.

With Trickle you can control the upload and download speeds for applications such that no single application hogs all the bandwidth. This gives you the power to ensure that downloads from Firefox don’t interfere with your attempts to download a file through FTP.

Shaping bandwidth traffic is one of the mundane tasks of a system administrator, be it in a large corporate setting or a small office. In the present day and age, I doubt there’s anyone who hasn’t himself experienced, or heard someone they know moan about one of the users on the network hogging all bandwidth.
The need to control bandwidth access for individual users on a network is a no-brainer, but you may ask yourself whether there’s any real need to limit the upload or download speeds for individual apps. The answer is yes, but there’s more to it than that. You can only truly appreciate Trickle if you’ve ever encountered situations where one application dominated the traffic making the lives of other apps a nightmare. At different times, due to many different reasons, applications may refuse to play nicely and cooperate.
I’m sure you’ve heard the tale of the warrior who came across a bridge that was only wide enough for one and on the other side stood another warrior. The only way to decide who goes first was by admitting the other as your superior or by engaging him in a fight and drawing first blood. How the story continues depends on which warrior the storyteller likes more or which warrior favoured Emacs over Vi.
Applications often face this situation too, since the bridge isn’t always wide enough for all the applications, and sometimes there are more than two applications that wish to use the bridge. Knowing how to throttle bandwidth available to applications is akin to having a shinier and sharper sword and skills that can be rivalled by none.
Not only that, it pretty much makes your blood transparent, so you can never lose a first blood contest. Plus, it makes the bridge wide enough for everyone. It’s a very zen solution, if you look past the lost glory of winning a first blood match. (OK: enough with the warrior metaphor –Ed)

Bandwidth plumbing

Trickle is just a yum install or apt-get install away if you’re on a Fedora or Debian/Ubuntu machine. You must have the libevent library, Trickle’s only dependency, already installed before you install Trickle. Most modern distribution will already have this installed. If you want, you can also install the celebrated traffic shaper from source with the configure, make and make install trio of commands.
Trickle regulates speeds by delaying the data transferred over a socket. Trickle provides an alternate version of the BSD socket API, with the effect that socket calls are now handled by Trickle. Speed is limited by controlling the amount of the data written or read from a socket. Trickle can only work on TCP connections, so you can’t use it to regulate UDP stream connection such as DNS.
Not only that, it can’t work with all TCP connections either. Since Trickle uses the dynamic linking and loading, it can only work with applications that use dynamic libraries (Glibc). Statically linked applications are thus not compatible with Trickle. To determine whether or not you can use Trickle to regulate speeds on an application, you can use the ldd command, which will give you a list of all shared libraries. So, if you’re wondering whether or not Trickle will work with the Epiphany browser, use the command:

ldd /usr/bin/epiphany | grep libc.so
libc.so.6 => /lib/libc.so.6 (0x00c14000)

You can similarly test for other applications such as KTorrent, KFTPgrabber etc. As long as you get a result, Trickle can regulate the speeds for those applications. To that end, you can even limit the bandwidth available to the RPM command when installing or querying packages.

Trickle isn't a strong enforcer of limits. When setting speeds, remember it can fluctuate by as much as 5kbps.Trickle isn’t a strong enforcer of limits. When setting speeds, remember it can fluctuate by as much as 5kbps.
error: Content is protected !!