I'm trying to stress test a particular PHP script that forces a a very large file to download, but specifically when clients with slow connections are making the request. I also want to concurrently test how the rest of the site performs under such a load. I have FiOS so doing a few dozen concurrent connections doesn't really put the server under load for very long (we don't care about volume as we don't anticipate a lot of concurrent connections for this file, just a few dozen really slow ones) and I want to test it as if I'm on a slow connection of say 100kb/sec. Is there a way to limit how fast ApacheBenchmark connects to a site? Or is there another way to temporarily throttle my connection to this site? I'm running Mac OS X locally, and the server is a Windows box running Apache.
One possibility would be to use the IPFW feature set of OS X. IPFW is the software firewall of OS X that happens to also support traffic shaping. Here's how to configure it (assuming a 18.104.22.168 as the web server IP address):
Now all traffic between your OS X computer and the web server will be limited to 15KB/s (change this value as needed).
To remove the configuration to revert to unlimited bandwidth:
Hope this helps.
I'm glad you're doing that; many people don't understand that their apps will behave fundamentally differently once they get out of the lab to the 'real Internet.'
The general category of what you're looking for is a WAN emulator. They sell hardware devices (and software) that do this from about $2k on up if you want to do it a lot and not just vary bandwidth, but latency, jitter, and other factors. Shunra and Linktropy are two good suppliers.
But there's a lot of software only solutions as well. Most of them run on Linux, but I imagine some might be coaxed to work on OSX. Wanem is a good free one. ns-2 is a free simulator, which is different and probably more complicated than what you want, you build out a fake network and it simulates that.
Or dummynet, but I'll add that to Urgoll's good answer.