Bandwidth-throttling Apache to simulate a slow server

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:

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 ( 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″

    <Location />
        SetOutputFilter throttle


1 comment
  1. dazzawazza said:

    ahh, cool. I will definitely use that. Would be good if you could introduce lag as well.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: