Throttling bandwidth for metered connections (like a Karma hotspot) in OSX
Recently I purchased a personal WIFI hotspot called Karma. It is a 4G LTE cellular modem that packages the cellular bandwidth as an 802.11 b/g/n WIFI hotspot for up to 8 users at a time.
Karma is a pay-by-use system, where each gigabyte of bandwidth costs $10-14 (depending on how much you buy at once). It never expires and there are no monthly plans.
The system is perfect as an emergency hotspot when you’re traveling if WIFI isn’t available. Since you only pay for what you use, you can be a sporadic user and not worry about wasting a monthly fee on unused bandwidth.
However, since you are paying by usage and not a flat monthly fee, you need to be aware of and vigilant about background applications that might be subtly flogging your bandwidth and end up unexpectedly costing you money. It was this dilemma that lead me down the rabbit hole researching automatic bandwidth throttling in OSX and how to set this up so the Karma hotspot doesn’t accidentally run up a big bandwidth bill.
This actually happened to me shortly after I first starting using Karma, where I racked up over $100 of bandwidth usage in two days from unchecked background applications left on while connected to Karma.
FIND THE HOGS
After talking to Karma about the situation* – background apps unintentionally using bandwidth – I knew the first step was to identify which background applications are the biggest offenders, and either find a way to throttle them, cap them, or turn them off when I’m on the metered Karma connection.
I didn’t want to limit my overall system bandwidth while on the Karma hotspot, but I did want to eliminate any non-essential bandwidth-hogging tasks, such as online backups or file transfers. An overall system-wide bandwidth throttling solution was not the answer. I would need something more granular.
First I used Little Snitch to see what was using background bandwidth. The biggest three offenders were:
Each of these applications serves a different function, so for each I used a different tactic:
Chrome tends to use a lot of processor power and bandwidth to sustain the myriad tabs we all keep open. An excellent way to keep this in check is The Great Suspender extension. This will “suspend” tabs after a certain period of inactivity, eliminating their processor/bandwidth load, but making it simple to revive them when you need them back.
Crashplan+ was the biggest non-essential application I could totally eliminate while on the metered Karma connection. This is a cloud backup applet that runs at all times, constantly uploading your files to the Crashplan cloud. Awesome when you’re on a fast connection at home or the office, less awesome when you’re paying for every kilobyte floating away from your computer. Enter ControlPlane:
FLY THE CONTROLPLANE
ControlPlane is a wonderful OSX application that combines if-then logic with system and application functionality to perform an almost infinite array of context-sensitive tasks. In my case, I set it up so it would detect when I connect to my Karma hotspot, and when I do, automatically close Crashplan+. It will then detect when I disconnect from the Karma hotspot, and reopen Crashplan+. With this solution, my biggest background bandwidth hog was reined in.
ControlPlane operates using “contexts.” A context is just a state your computer is in based on the inputs you define. For example, you can set the input sniffer to recognize when you connect to the Karma hotspot, and then do things. Like open and close applications.
- Install ControlPlane
- Turn on your Karma hotspot and connect to it – you’ll need to do this in order for ControlPlane to recognize the Karma hotspot as an “if” variable
- Open the ControlPlane preferences pane. Here’s how my general tab looks:
- Contexts > Create a new context – I called mine “Karma Hotspot.” Once everything is setup correctly, your system will detect when you’re connected to the Karma hotspot and then “enter” this context.
- Evidence Sources > Choose your evidence sources. This is the “if” in the if-then logic. I used:
- Active Network Adapter
- Nearby WIFI Network (this is a slightly misleading label, it should really read “Connected WIFI Network”)
- Power Source (I included this as an option, but didn’t end up using it for the context)
- Rules > Setup your rules. This defines when ControlPlane will actually do something. I created two rules:
- If a WIFI SSID of “Free WIFI by Karma” is connected, it will activate the “Karma Hotspot” context
- If the WIFI link is active, this will strengthen the decision-making process by ControlPlane to activate the “Karma Hotspot” context
- Actions > Setup your actions. I created two actions:
- Close Crashplan+ when I am on the Karma hotspot
- Open Crashplan+ again once I’m off the Karma hotspot
- Close Crashplan+ when I am on the Karma hotspot
I had to dig around and find the exact path for the Crashplan+ menu bar applet in order to open it again upon leaving the Karma hotspot. On my system the path is this:
/Applications/CrashPlan.app/Contents/Helpers/CrashPlan menu bar.app
That’s my configuration. Works great on my 2013 Macbook Pro 15″ Retina and 2015 Macbook Air (both Yosemite).
From there you can add all sorts of other application closing/opening (and other magical functions), but this should give you enough to get started. Enjoy!
- Use Little Snitch to monitor bandwidth and determine what hogs background bandwidth
- Use The Great Suspender to limit Chrome tabs from sucking up bandwidth (and processor power)
- Use ControlPlane to automatically close and reopen nonessential bandwidth-hogging applications
* Karma was SUPER cool and understanding about the situation and offered me some free bandwidth credit after I explained what had happened.