Throttle Bandwidth for TestingMarch 27, 2014 - Jake Bresnehan
Working with a fast internet connection on a day-to-day basis is a real privilege. it’s easy to forget that others are less fortunate.
With a recent vacation to “slow internet land” this really hit home. So much so, once being back in “fast internet land” I explored the different ways to throttle bandwidth for testing. Since then, I’ve made a pact to myself to incorporate bandwidth testing into my go-live checklist.
After a little research, here are few different methods that I discovered.
Network Link Conditioner
If you develop on a Mac or have access to one I would highly recommend utilising the Network Link Conditioner that can be accessed via Xcode.
Once you have downloaded and installed Xcode, open the “More Developer Tools…” option which can be found nested inside the Xcode menu item.
Xcode > Open Developer Tool > More Developer Tools...
After selecting “More Developer Tools…” you will be redirected to the Apple Developer website.
Once logged in using your Apple ID you will be able to access the “Hardware IO Tools for Xcode” file. Download this.
Note: If you are running Mavericks you should be all good with the latest. If running Mt Lion you might need to install an older version.
Once downloaded, install by clicking on “Network Link Conditioner.prefPane”.
After the successful installation, the Network Link Conditioner can be found at the bottom of your System Preferences.
The Network Link Conditioner has lots of built in options as well as an easy interface to customise your desired testing limits.
Also don’t forget to clear your cache to get an accurate representation of the page loading and remember to turn it off when you have completed your testing.
If you don’t have Xcode installed, Slowly App will also do the trick.
Slowy is an OSX MenuBar app, so it is lightweight and is placed only on the system top bar. The free version comes with two options (56K and LTE/4G) and the paid version for only $5 comes with 3 other options (EDGE, 3G and DSL) plus a custom preference panel. The custom preference panel enables you to create custom testing profiles until your heart’s content.
The Command Line
If installing additional software is not your cup of tea you can dive into the terminal to simulate a slow connection.
A word of warning. The
ipfw command has been deprecated and is slightly tricky to find any up to date information about it. If you decide to dive into it, this man page might be helpful.
In the terminal:
$ sudo ipfw pipe 1 config bw 15KByte/s $ sudo ipfw add 1 pipe 1 src-port 80
This will restrict all incoming bandwidth to 15 Kb.
Change it to whatever value you like.
$ sudo ipfw pipe 1 config bw 2KByte/s $ sudo ipfw add 1 pipe 1 src-port 80
To remove throttling:
$ sudo ipfw delete 1
Further reading about
ipfw can be found on this Quora question.
Another option that looks interesting is this Grunt Throttle task by Tiago Quelhas. Simply roll with the defaults or fine tune the Gruntfile to get the desired result.
Hopefully the above have given you a little insight and inspiration to do bandwidth testing. As websites get bigger and bigger each year, I feel we have a duty to provide the greater community the opportunity to also enjoy our creations.
I’m not an expert in this throttling game so if you have any insights, resources or tips please don’t hesitate to continue the conversation below.