Currently displaying posts authored by Omar...

Throttling Bandwidth in OS X

September 07, 2011. Posted by Omar in Development, Mac OS X

When you've got a low latency 20 megabit connection that load pages in an instant, it's impossible to see how our unfortunate internet brethren may see your page load. This particular set of commands that throttle bandwidth proved extremely useful to me when getting certain javascript functions to work before the page was fully loaded. "ipfw" is shipped with OS X and is probably present in some linux distros.

 sudo ipfw pipe 1 config bw 40KByte/s

This creates a pipe that only allows up to 40KB/s to go through. If you want to simulate dial-up, set it to 5KByte/s!

 sudo ipfw add 1 pipe 1 src-port 80

This will attach that pipe on port 80, effectively throttling its bandwidth.

 sudo ipfw delete 1

When you're all done you'll want to remove the bandwidth restriction, unless you're old and miss the days of having slow internet, revelling in anticipation as jpegs slowly load. 

There you have it! No need to download extra software to throttle your bandwidth.

View Comments