note 12319 deleted from function.mysql-pconnect by jimw

From: Date: Fri, 07 Dec 2001 01:45:43 +0000
Subject: note 12319 deleted from function.mysql-pconnect by jimw
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-21770@lists.php.net to get a copy of this message
We run a heavily loaded site on our systems (>2,5 million hits a day) and make extensive use of PHP4 (several versions tested) and MySQL 3.23 (also several versions tested, currently running 3.23.33). I was always using mysql_pconnect() instead of mysql_connect() until someone suggested I ran some benchmarks because pconnect might actually be slower. I don't have any numbers to back this up anymore but the results were stunning, mysql_pconnect() was actually MUCH SLOWER than the normal mysql_connect(). Also the memory requirements of MySQL were higher when using pconnect. The server the DB runs on has 1GB RAM so swapping is not an issue here. We have only 3 different databases on our server (totalling about 200MB data) and about 100 to 200 open mysql connections at a time, so theoretically this is an ideal situation to use persistent connections. Also, all connections use the same user/password combination. In the past few months I have been testing this on different sites and different servers and mysql_connect() is consistently faster than mysql_pconnect(). So I'd recommend anyone to stay away from this function or at least do some thorough benchmarks of your own site with or without pconnect because it might help you gain some performance.

« previous php.notes (#21770) next »