开发者

Know if a MySQL server is overloaded with PHP

It's possible to know if a MySQL server is overloaded (with PHP), and if it's ov开发者_运维知识库erloaded show a static page (something like Twitter's fail whale)? How can I do it?

Thanks!


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜