Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Is there a way to configure apache2 to stop serving requests if a specific value of server load (like the value that you see when using htop) is reached? Ideally a predefined static page should be served in such case?

If this doesn't make sense then what is the correct way of letting the server rest if it's getting overloaded? Except for correctly configuring all the values in apache2 configuration of course. I need a temporary rescue solution.

share|improve this question
add comment

2 Answers

Sounds like you're running into scalability issues. Unfortunately, I don't think Apache has this mechanism. The correct way I've seen it done is by having a reverse proxy of sorts (nginx or even HAProxy) sit in front of Apache and check the response times. If it's too slow, it can display a "sorry" page and let Apache cool off.

Hope this guides you in the right direction.

share|improve this answer
add comment

You can see if monit can help you. It has a load trigger that you can use to restart servers, run custom scripts and etc... Maybe you can create a custom script to change apache config files.

Varnish has a Saint mode with Grace time, it will show the last version of the cache if a backend takes too long to respond, maybe it is better than just showing a "sorry" page. OTOH, varnish is not trivial to configure.

share|improve this answer
add comment

Your Answer

 
discard

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.