Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have an Apache server that is serving a django application with mod_wsgi. I'm wondering if there is a simple way to throttle requests at the apache level based on the machine's load.

Ideally I want an apache module that if the load is below a certain figure, everything works OK. However if the load is above something, then X% of IP addresses will be served the static html page for Y minutes. Does that software exist?

We are looking for a "poor man's throttling system". Something quick and easy we can drop in. Throttling based on machine load is good because it means things will eventually return to normal.

Our web application does a lot of processing, so things that limit bandwidth aren't going to pick up on this, it's not bandwidth we want to 'throttle' but, requests. Ideally we'd want some existing requests (i.e. based on IP address) to be able to continue for a certain amount of time (so they can finish doing their stuff).

share|improve this question
Hello, did you manage to achieve your goal? – user130370 Nov 21 '13 at 9:19
No, and I'm not working on that project anymore. – Rory Jan 23 '15 at 16:04

I've never set this up myself, and I appreciate this isnt exactly what you are looking for (ie its not an apache module) but there is a tool called traffic control. Given that tc is invoked by a simple command line, it seems likely that you can integrate it into your own script, and instigate the throttling you want based on the load output from top, or whatever else you have monitoring load.

There's an example script on this page:

share|improve this answer

Disclaimer: I'm a varnish fanboy.

I'm not aware of any official apache module doing this natively.

Varnish can serve static html if backend (django) does not respond within specified time.

If you really want to serve static file to 10% of visitors based on load average, I guess it can be done with vmods (I guess you'll have to write your own).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.