The more opinions I read on this issue, the more confused I get. I have a book that suggests using pconnect because it's faster and creates less stress on the mysql server than regular connect. I've read in other places, that the regular connect is better because it creates less simultaneous connections that aren't always necessary and that the speed difference is so small that it doesn't matter.
I've been using pconnect as a standard (because of Dreamweaver) and haven't seen a problem until just recently. I upgraded mysql to the latest version, and I believe I read somewhere in the mysql installation notes that they suggest not using pconnect. Immediately after the upgrade, there were some connection errors, but I believe that was because of old sessions trying to connect. Those errors dissolved after the 1st day.
Yesterday, I had some "Too Many Connections" errors. I'm not sure why this happened.
So, I'm just looking for reasons to use one or the other. My website averages about 15-30 simultaneous visitors most of the day. I peak at about 60. About 95% of my site pages uses a mysql connection. Probably 99.99% of the traffic is on a page with mysql.
All suggestions and opinions are appreciated. I said in the first sentence, that the more opinions I get, the more confusion it causes. But, so far that's because I'm getting an equal amount of opposing views. I'm hoping I'll get an overwhelming majority of which is better.
Thanks in advance!
mysql_pconnect() vs. mysql_connect
Moderator: General Moderators
If the mysql server is on the same server as the webserver then using pconnect can actually cause more of an overhead than just a connect.
Plus pconnect 'ties' up connections that could be used by other processes. I'd stick with a connect unless you're using distributed databases or a database on another server etc..
Plus pconnect 'ties' up connections that could be used by other processes. I'd stick with a connect unless you're using distributed databases or a database on another server etc..