When we originally deployed our MODx site (around a year ago) we were seeing the "too many connections" error from MODx rather frequently. I changed some PHP code in our forum software that I thought was the issue, and the error did go away for a while.
However, last night it reared its ugly head again. As a web-based business we simply cannot afford to allow our site to go down at random times without trying to do anything about it. For reference, we were seeing the same issue as discussed here several months ago:
http://modxcms.com/forums/index.php?action=printpage;topic=27824.0
We are running MODx on a dedicated load-balancing server along with some shopping cart software and phpBB. These are the only 3 things that ever make any connection with our database. We have our max connections limit set well above 1000; we do not use stats logging. We receive probably around or less than 10,000 visitors per day.
I am not so much interested in whether or not MODx is causing this error as I am in eliminating all possible causes (there has already been a debate on these forums whether MODx can cause this, and that is not my intent). In researching this problem, I have seen that pconnect() may be a culprit. I searched the MODx directory for this function and found only 2 occurrences in the following places:
manager\includes\extenders\dbapi.mysql.class.inc.php(87):
if (!$this->conn = ($persist ? mysql_pconnect($host, $uid, $pwd) : mysql_connect($host, $uid, $pwd, true))) {
\includes\db\mysql.php(48):
$this->db_connect_id = ($this->persistency) ? @mysql_pconnect($this->server, $this->user, $sqlpassword, $new_link) : @mysql_connect($this->server, $this->user, $sqlpassword, $new_link);
(It looks like to me that this code is checking for a ’persistency’ setting, I haven’t really looked into it so I’m not sure.) I am wanting to change these calls to from pconnect() to vanilla connect(). Can anyone foresee any issues if I do this? I can’t think of any but I wanted to be sure.