availability: January 2017
As a developer when you are working on your local machine, it's easy to forget that there are still a lot of people out there without sufficient broadband access.
Especially when executing long browser transactions like file uploads or running lenghty reports, timeout can have an impact on the way our code reacts to endusers.
Usually this involves asking the network guys to setup a slow link to see this. Thanks to http://www.macosxhints.com/article.php?story=20080119112509736 I found an easy way to simulate this on my local Mac machine.
Enter the use of ipfw, the firewall system provided by Apple. A less know feature is that i can also shape traffic. The following example is a simulation of enduser with a bandwith of 15KByte/s.
sudo ipfw pipe 1 config bw 15KByte/s
sudo ipfw add 1 pipe 1 src-port 80
That should to the trick. Still there a few caveats, this does not work for localhost as this traffic does not pass through the ip filter. The other thing is that this will slow down all web traffic, so you might to specify destination in the pipe add command.
sudo ipfw delete 1
A more advanced explanation can be found on http://www.afp548.com/article.php?story=20060214081244545