Simulating Limited Bandwidth

Recently I was dealing with an issue where some JS ran fine locally, but not on a staging server. I tracked the problem down to a bandwidth issue – images loaded lightning fast locally but were slow on the staging server and that caused my problems.

In order to solve the problem I needed to find some way to slow down requests on my local system. I tried various solutions such as Apple’s Network Link Conditioner and various ways of configure ipfw or pf but none of them worked.

Then I took a walk. It’s amazing how sometimes getting up and stepping away from the computer for a bit shakes stuff loose and lets you attack a problem from a different perspective. When I got back, I realized that I just needed to slow down the images, not the entire site. This led me to was exactly what I needed. I simply prepended the delay URL to all of my image calls and was able to fix my JS issues in my local development environment.