NYCPHP Meetup

NYPHP.org

[nycphp-talk] PHP and MySQL Connections

Randal Rust randalrust at gmail.com
Fri Apr 11 06:51:34 EDT 2008


We have been having some performance issues on one of our larger
sites, and I'm trying to figure out the best way to go about fixing
them. We use the adoDB abstraction library. Since day one, we've used
persistent connections, and I think that might be at least part of the
problem. So if I switch from the persistent connection, PConnect() to
the non-persistent, Connect(), I want to make sure of one particular
thing:

My understanding is that PHP automatically cleans up a database
connection after it has executed the query. Therefore, I don't need to
use the close() function. Is that correct?

On a related note, our main issue is that the site keeps slowing down
and we are getting a 'Too Many Connections' error from MySQL. I had
the number of connections increased from 100 to 150 on both Apache and
MySQL two weeks ago, but we are still having the problem, although
less frequently. One thing I'd like to be able to do is check how many
connections have physically been made to the database. I did this a
couple of weeks ago, but now I can't find the MySQL query returns that
information. If anyone could throw that out to me, I'd greatly
appreciate it.

-- 
Randal Rust
R.Squared Communications
www.r2communications.com



More information about the talk mailing list