I have an application and want to code it so that it can be shut down
temporarily for maintenance, at various times.
However, the system is one that allows for users to log in, and send
messages, perform various actions, etc. It would be best to not disrupt a
user during the middle of composing a mail, for instance, and prevent him
from posting it.
However, doing a check at every page load will put extra stress on the
application, especially if it's high traffic.
What are some of the ways to accomplish this task most efficiently, while
interfering with users in the least intrusive way?