We have the need to lockout users from our service when its under load to avoid degraded user experience. We have implemented a very rough and ready version of this by detecting errors or timeouts on ajax requests and displaying a popup saying we are experiencing issues and redirect the user to the lockout page. But I get far too many false negatives on this, and just refreshing the page cause the popup to show because the ajax requests are aborted etc.
How do websites normally go about this sort of stuff? Is it handled server side, client side or by apache etc?