A customer reported a bug with an AJAX-powered web UI. The problem only manifested itself at certain times of day, coinciding with high traffic to the web server, indicating that it was load-related.
So, how to simulate a sluggish server to try to reproduce the problem?Apache itself doesn’t seem to provide any throttling. There are third-party modules out there to do it but I didn’t want to spend the day compiling Apache. I found this simple command line UNIX tool which limits i/o: http://klicman.org/throttle It built cleanly from source and worked as advertised. To stick this between the browser and Apache, I used the mod_ext_filter Apache module (http://httpd.apache.org/docs/2.2/mod/mod_ext_filter.html) which lets you filter Apache’s output through an external command. It’s a built-in module and seems to be enabled by default in my stock Apache (on Fedora Linux). To simulate a good ol’ 56kbps modem, the httpd.conf magic is: ExtFilterDefine throttle
cmd=”/local/tmp/throttle-1.2/bin/throttle -k 56″
preservescontentlength <Location />