Simulating a slower connection
When developing a website locally it’s easy to forget about loading times and their impact on the browsing experience. Luckily, we have plenty of tools at our disposal to diagnose and improve our web page loading performance – YSlow, Google PageSpeed Insights, and the Chrome website performance auditor.
While the aforementioned tools are great, sometimes it can be more helpful to actually experience the loading process on a slower connection.
For this reason, I’ve put together a simple script that will allow you to throttle your network connection on a specific port (e.g. port 80 for web traffic) – even when loading a resource from your own machine!
Usage couldn’t be simpler. To slow all traffic on port 80 down to around 3G speed:
./thottle.sh -p 80 -s 200
The -s parameter accepts a speed in kB. To reverse the effects:
Don’t forget to do this, or you’ll be left wondering why your connection is so slow for the rest of the day!
Unfortunately, throttle.sh will only work on OS X as it uses ipfw behind the scenes.
The script is available on Github.