Re: diagnosing sql connections spike
Early in the morning on a shared box may mean your provider doesn’t know what they are doing and is not running the daily backup in “nice” mode, therefore overloading the server.
Either that or you might have a misbehaving neighbor.
bbPress doesn’t naturally cause that kind of problem, unless you are running an older alpha which uses more queries – and some of my plugins like hidden forums had a bug in a previous version that caused extra queries – you only used 10 queries so I think you are running 0.9
If you know what you are doing, even on a shared host you can run a simple PHP program with cron checking the load every minute – the moment it starts to spike, say over 3.0, you can have it email you “ps aux” which will show you which neighbor is misbehaving, even on a shared host.
bb_init = 0.178 <<<
bbpress’s core is completely loaded at this point,
plugins, everything the amount of time is okay and acceptable – 50 to 100 files have been loaded
bb_index.php_pre_db = 4.966 <<<—- this is kind of a lie, it’s not pre-db, there have been some queries…
so in 4.5 seconds or so, here’s what’s been done:
$forums = get_forums();
$topics = get_latest_topics();
$super_stickies = get_sticky_topics();
it’s actually loaded all the forums and gotten the latest topics
It’s using about 8-9 queries so 4.5 seconds is absolutely terrible, almost impossible if the server is working correctly.
If your page time is normally under 1 second for that part, here’s what I think is happening.
I think your host is running a backup at that hour OR one of your neighbors on the same box is doing a remote backup to/from the server, including mysql.
That ties up the cpu and ties up mysql because the disk is thrashing and mysql is not caching at all.
To prove my theory, see if it happen every day at the exact hour.
Even more suspect would be if it happens on the hour or half hour.
By the way, why do you assume it’s “your” mysql connections that have been exhausted – it’s actually the entire server’s pool on a shared host. I suspect you have a misbehaving neighbor who is accidentally making you think it’s you that’s the problem.