php – MySQL too many connections on shared server

We have run a PHP/MySQL blog site on a shared server for years with no problem (my code not WordPress). I’m not an system or database guy except for what I need. Our host (BlueHost) moved our site to a new server, and our capacity to serve our audience has dropped significantly. We’re experiencing a seasonal spike now, so that makes it worse. So much so that we’re also using another identical site to bear the load (GoDaddy). Not ideal. I don’t have admin privileges obv, but I can see that we get 1000 max connections on GoDaddy and 150 on BlueHost (not sure what it was before).

I’ve been tracking the Threads_connected and Threads_running for both sites (again identical sites). GoDaddy never gets above ~25 connected and ~2 running. BlueHost will start to stack up Threads_connected until it hits the 150 limit mark. I’m trying not to break our resource allotment, but even with a lot of (and sometimes all) traffic redirected over to GoDaddy, BlueHost will stay above 120 for an extended period of time. Not sure if it’s a caching issue or what.

I’ve tried doing an ‘inline’ declaration for Threads_connected and Threads_running when I open my PHP/PDO connection to MySQL, and I’m somewhat skeptical that it’s fixing the problem.

$dbh_ip_check -> exec("SET session wait_timeout=10"); 
$dbh_ip_check -> exec("SET session connect_timeout=10"); 

We don’t get a huge amount of traffic, but our spikes are probably seeing >100 people hit the site at a time, and that would continue for a half hour or more.

Any recommendations for fixes on a shared server? Thanks.