Hi,
It's possible to know if a MySQL server is overloaded (with PHP), and if it's overloaded show a static page (something like Twitter's fail whale)? How can I do it?
Thanks!
views:
47answers:
1
A:
The closest you'll get to that in the standard MySQL PHP API is mysql_stat. Beyond that, you'd be limited to using PHP to issue a system command to call an external script. You could use that to issue whatever system command you feel would give you a good indication of server health and react appropriately.
I'd suggest, however, that you only run you check every 5 or so minutes and cache the results, and to do this separately from your normal page loads. Your page loads would simply check the cached value to determine whether or not to show your static page.
Shaun
2010-06-12 15:56:19
That's the best idea!
Francesc
2010-06-12 16:09:55