Just recently I really need to take a precaution on my rsync bandwidth since it draws a lot of resource regarding to my regularly sync repository. I don’t want to drag the whole webserver run in cucumber’s hole queuing so I must find a solution fast. I came on quick search and find this trickle utility is quite good. It’s a small and lightweight userspace bandwidth shaper. It can run in collaborative mode (together with trickled) or in stand alone mode. So it must pretty much same as cpulimit but bandwidth now is the object.
The compiling is pretty much easy, just configure, make, make install, there’s no need to resolve dependencies except libevent. I dunno much if this package exist in backport, but because it can be compile easily on the first try, then I forget the rest. Ok, now trickle is on /usr/bin and ready to roll.
Here is the command I use to shape my rsync bandwidth :
rsync -auvPe "trickle -d 80 ssh" user@host:/src/ /dst/
The results is quite good, now the webserver almost open spontaneously which way much improvement then not using this trickle.
Here is the output shape graph on their site to show the difference :
Maybe some of you asking why on earth we must use this trickle instead of the built in bwlimit on rsync ? Yeah … besides the smoothing effect there’s nothing special because rsync has built in function to limit the bandwidth, but how about sftp and sshfs ? To be honest I like the smoothing in trickle because they shape the bandwidth quite good, you can see for yourself using Cacti or Nagios.