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 :-)
|Dynamic DNS—an Object Lesson in Problem Solving||May 21, 2013|
|Using Salt Stack and Vagrant for Drupal Development||May 20, 2013|
|Making Linux and Android Get Along (It's Not as Hard as It Sounds)||May 16, 2013|
|Drupal Is a Framework: Why Everyone Needs to Understand This||May 15, 2013|
|Home, My Backup Data Center||May 13, 2013|
|Non-Linux FOSS: Seashore||May 10, 2013|
- RSS Feeds
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)
- Using Salt Stack and Vagrant for Drupal Development
- Dynamic DNS—an Object Lesson in Problem Solving
- New Products
- Validate an E-Mail Address with PHP, the Right Way
- Drupal Is a Framework: Why Everyone Needs to Understand This
- A Topic for Discussion - Open Source Feature-Richness?
- Download the Free Red Hat White Paper "Using an Open Source Framework to Catch the Bad Guy"
- Tech Tip: Really Simple HTTP Server with Python
- Keeping track of IP address
39 min 27 sec ago
- Roll your own dynamic dns
5 hours 52 min ago
- Please correct the URL for Salt Stack's web site
9 hours 4 min ago
- Android is Linux -- why no better inter-operation
11 hours 19 min ago
- Connecting Android device to desktop Linux via USB
11 hours 48 min ago
- Find new cell phone and tablet pc
12 hours 46 min ago
14 hours 15 min ago
- Automatically updating Guest Additions
15 hours 23 min ago
- I like your topic on android
16 hours 10 min ago
- This is the easiest tutorial
22 hours 45 min ago
Enter to Win an Adafruit Pi Cobbler Breakout Kit for Raspberry Pi
It's Raspberry Pi month at Linux Journal. Each week in May, Adafruit will be giving away a Pi-related prize to a lucky, randomly drawn LJ reader. Winners will be announced weekly.
Fill out the fields below to enter to win this week's prize-- a Pi Cobbler Breakout Kit for Raspberry Pi.
Congratulations to our winners so far:
- 5-8-13, Pi Starter Pack: Jack Davis
- 5-15-13, Pi Model B 512MB RAM: Patrick Dunn
- 5-21-13, Prototyping Pi Plate Kit: Philip Kirby
- Next winner announced on 5-27-13!
Free Webinar: Hadoop
How to Build an Optimal Hadoop Cluster to Store and Maintain Unlimited Amounts of Data Using Microservers
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Some of key questions to be discussed are:
- What is the “typical” Hadoop cluster and what should be installed on the different machine types?
- Why should you consider the typical workload patterns when making your hardware decisions?
- Are all microservers created equal for Hadoop deployments?
- How do I plan for expansion if I require more compute, memory, storage or networking?