trickle: manage bandwidth usage on Linux

cool_penguin_smallEveryone encounters this common situation – one of the processes using the whole bandwidth and others starving appearing slow. trickle is the solution on Linux. It is a network bandwidth manager. Before going into the usage we’ll discuss the requirements for trickle:

  • The program you want to monitor should be dynamically linked to glibc (the libc.so shared library). The reason is that trickle is a userspace application that uses the¬†loader preloading technique. Essentially it provides a new socket interface and the original one is masked. To know whether your program meets the requirement use ldd.
    $ ldd /usr/bin/axel|grep libc.so
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007ff552ce1000)

    So yes, axel can be a candidate if it meets the next requirement.

  • The program must use the TCP protocol. To check that, use netstat after running the program.
    $ netstat -pa|grep axel
    tcp 0 0 192.168.0.16:37901 alpinecurrant.cano:http ESTABLISHED 10966/axel

    axel does use TCP! axel is fit for being used with trickle.

Trickle can be used in 2 modes – as a standalone utility for each program or as a daemon that can handle multiple programs fired with trickle.

  • As a standalone program
    trickle -u 128 -d 64 myprogram

    where u denotes upload limit and d denotes download limit in KB/s.

  • As a daemon
    trickled -u 512 -d 256

    sets the cumulative limit for all the programs run using trickle.

trickle can be used by non-root users. You can run your favourite terminal session using trickle and all programs (matching trickle’s criteria) run from the terminal will be monitored by trickle.

trickle is available in the default repositories on many distros, including Ubuntu.

Webpage: trickle

One thought on “trickle: manage bandwidth usage on Linux”

Comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s