trickle: Bandwidth shaping … I think

I promise you: This is a screenshot of Midnight Commander running in an envelope created by trickle, in the middle of a download from the Debian FTP site.

2014-06-04-6m47421-trickle-mc

The problem with that image is, I asked trickle to limit the download speed to 20kbps, and I’m not so sure it got the message.

trickle is a bandwidth shaper that supposedly can run in userspace, meaning it doesn’t need root privileges. Something like that might be useful for a download manager or any time you want something to download in the background, but not hog the entire line.

My problem is that, three or four times now, and with examples directly off the man page, trickle doesn’t seem to be doing its job. Download speeds appear to be well beyond the limits I ask trickle to enforce, as you can see above. You try it and see what happens:

trickle -s -u 10 -d 20 mc

I think my difficulty is compounded by the fact that, as far as I can tell, trickle doesn’t really show any output, so I’m not even sure it’s doing something back there.

This is another one of those times when I suspect I did something wrong, or configured it incorrectly, and as a result trickle is just twiddling its thumbs in the background. Still, it’s kind of hard to go wrong when you copy-and-paste from the man page. 🙄

The only other reason I could think of for trickle’s apparent reluctance is that the code is well over a decade old. If trickle has run into the same difficulties as the dozens of other programs lost to time, then that might explain a few things.

I’ll leave it to you to try trickle and see if it does what it was intended to do. If you get it working, please send me a note and tell me how. Thanks in advance. 😉

Advertisements

8 thoughts on “trickle: Bandwidth shaping … I think

    1. K.Mandla Post author

      Curiouser and curiouser. I’ll try to rebuild it and see if it works correctly. Thanks for letting me know; I had a feeling it was something on my end. Cheers!

    2. darkstarsword

      Trickle uses LD_PRELOAD to override the socket libc calls and insert delays in an attempt to indirectly coerce the sender to slow down (only the sender can throttle a connection and there is no way in the TCP protocol for the receiver to directly tell it to do so, but TCP will automatically rate limit if it believes that packets are being dropped or significantly delayed).

      The reason that your trickle sudo pacman didn’t work is that LD_PRELOAD will not work on suid/sgid binaries (such as sudo) because that would be a major security hole – as you noted putting the sudo before trickle will work as then the LD_PRELOAD from trickle is not trying to act on a suid binary, but rather directly on pacman (also, by that point in the command line it’s already root).

  1. Pingback: trn: In spite of my best efforts | Inconsolation

  2. Jason Hamilton (@laydros)

    I recently started working somewhere that we only have a single T1 line, so 1.5Mbit max, and I don’t want to hog all the bandwidth. So I googled around and discovered trickle. I have only tried it with wget and youtube-dl. All I have tried is something like:

    $ trickle -d 50 wget http://somedownload.com

    And it seems to work pretty well for those.

Comments are closed.