Traffic Control with tc
This weekend I had an interesting dilemma. I needed to transfer about 2GB worth of data to a remote machine. That's not really a lot to download, but it can be quite a pain on an asynchronous upload home Internet connection where your upload speed is pitiful! So, I began the transfer, and wouldn't you know that halfway through, my roommate returned from work. Now, since my roommate works at a startup called Blinkx in downtown San Francisco, he has work to do pretty much 24/7. I didn't want to disturb his work, but I also didn't want to cancel my transfer. What was a hacker to do :-(
After feeling defeated for about five minutes and having no idea how to shape the current traffic connection, I stumbled onto something. tc! Yes, tc can do everything you need to shape traffic. Amazing. A little man page reading later, and in ten minutes, I was now happily transferring data and not hogging all the upload bandwidth from my roommate. Here's how I was able to limit my upload to ~30KB/sec, from our cap of ~100KB/sec.
# tc qdisc add dev eth1 root handle 1: tbf rate 300kbit burst 300kbit latency 1
Now, this command is quite a hack. I didn't actually bother to find the best options for the job, but then again, I didn't have much time. The command above merely limits the connection of my wireless device to ~30KB/sec using the Token Bucket Filter mechanism.
I highly encourage the reader to find more advanced usage of tc and craft some beautiful shaping rules. If you don't want as much control, then you may consider other useful tools such as trickle/trickled (user-space) and wondershaper. Happy hacking :-)
|Updates from LinuxCon and ContainerCon, Toronto, August 2016||Aug 23, 2016|
|NVMe over Fabrics Support Coming to the Linux 4.8 Kernel||Aug 22, 2016|
|What I Wish I’d Known When I Was an Embedded Linux Newbie||Aug 18, 2016|
|Pandas||Aug 17, 2016|
|Juniper Systems' Geode||Aug 16, 2016|
|Analyzing Data||Aug 15, 2016|
- Updates from LinuxCon and ContainerCon, Toronto, August 2016
- NVMe over Fabrics Support Coming to the Linux 4.8 Kernel
- What I Wish I’d Known When I Was an Embedded Linux Newbie
- New Version of GParted
- Tech Tip: Really Simple HTTP Server with Python
- Analyzing Data
- All about printf
- Tor 0.2.8.6 Is Released
- Returning Values from Bash Functions
With all the industry talk about the benefits of Linux on Power and all the performance advantages offered by its open architecture, you may be considering a move in that direction. If you are thinking about analytics, big data and cloud computing, you would be right to evaluate Power. The idea of using commodity x86 hardware and replacing it every three years is an outdated cost model. It doesn’t consider the total cost of ownership, and it doesn’t consider the advantage of real processing power, high-availability and multithreading like a demon.
This ebook takes a look at some of the practical applications of the Linux on Power platform and ways you might bring all the performance power of this open architecture to bear for your organization. There are no smoke and mirrors here—just hard, cold, empirical evidence provided by independent sources. I also consider some innovative ways Linux on Power will be used in the future.Get the Guide