Fw: [PHP-DB] pconnect vs connect

From: Date: Wed, 18 Oct 2000 22:02:37 +0000
Subject: Fw: [PHP-DB] pconnect vs connect
Groups: php.db 
Request: Send a blank email to php-db+get-3759@lists.php.net to get a copy of this message
----- Original Message ----- From: "Sheer El-Showk" <sheer@tartarus.netherrealm.net> To: <php-db@lists.php.net> Sent: Wednesday, October 18, 2000 1:24 PM Subject: [PHP-DB] pconnect vs connect > Hi, > > I'm one of the developers working on the phpauction project > (www.phpauction.org). Recently, I tried converting the code to use > mysql_pconnect rather than mysql_connect. Since a database connection > is invoked on every web page, I thought my change would greatly enhance > performance, but my results were a little suprising (I tested using both > connect and pconnect twice, once to "warm up" apache and mysql, and a > second time with the warmed up system -- I didn't try tweaking > any paramters). The test results are included below, but its enough to > say that pconnect actually decreased performance slightly. > > My guess is that the open connections (I used mysql processlist to verify > that connections WHERE being reused) did not yield any performance > enhancements, and the extra time pconnect spends checking for used > connections is reflected in the slight performance loss. > > My question: why? Is MySQL that fast at opening a connection. > Alternately, is php that slow (on the same machine I got 25 pages > per minute using Apache Jserv, albeit on an entireley different script > -- though they both opened several database connecetions). I'm a relative > newcomer to php, but I thought that it was native to the apache process, > the same way mod_perl is, so it would be REALLY fast. Is this not the > case? Where (online and for free ;->) can I find information regarding > the php backend architecture that would elucidate these issues (please > don't just say www.php.net). > > Thanks in advance, > Sheer El-Showk > > Benchmarks: > > Please forgive the full benchmark listing, I just thought I'd be thorough. > > Warm up tests: > -------------- > > > mysql_connect: > > /usr/local/apache/bin/ab -n 1000 -c 10 > http://192.168.1.2/~sheer/phpauction/index.php3 > > Server Software: Apache/1.3.12 > Server Hostname: 192.168.1.2 > Server Port: 80 > > Document Path: /~sheer/phpauction/index.php3 > Document Length: 15286 bytes > > Concurrency Level: 10 > Time taken for tests: 141.273 seconds > Complete requests: 1000 > Failed requests: 154 > (Connect: 0, Length: 154, Exceptions: 0) > Total transferred: 15606422 bytes > HTML transferred: 15308942 bytes > Requests per second: 7.08 > Transfer rate: 110.47 kb/s received > > Connnection Times (ms) > min avg max > Connect: 0 0 54 > Processing: 106 1401 3237 > Total: 106 1401 3291 > > > mysql_pconnect: > > Server Software: Apache/1.3.12 > Server Hostname: 192.168.1.2 > Server Port: 80 > > Document Path: /~sheer/phpauction/index.php3 > Document Length: 15286 bytes > > Concurrency Level: 10 > Time taken for tests: 153.657 seconds > Complete requests: 1000 > Failed requests: 190 > (Connect: 0, Length: 190, Exceptions: 0) > Total transferred: 15590002 bytes > HTML transferred: 15293410 bytes > Requests per second: 6.51 > Transfer rate: 101.46 kb/s received > > Connnection Times (ms) > min avg max > Connect: 0 0 54 > Processing: 277 1529 3700 > Total: 277 1529 3754 > > > > real test: > > mysql_connect: > > /usr/local/apache/bin/ab -n 1000 -c 10 > http://192.168.1.2/~sheer/phpauction/index.php3 > > Server Software: Apache/1.3.12 > Server Hostname: 192.168.1.2 > Server Port: 80 > > Document Path: /~sheer/phpauction/index.php3 > Document Length: 15286 bytes > > Concurrency Level: 10 > Time taken for tests: 126.953 seconds > Complete requests: 1000 > Failed requests: 205 > (Connect: 0, Length: 205, Exceptions: 0) > Total transferred: 15581755 bytes > HTML transferred: 15285755 bytes > Requests per second: 7.88 > Transfer rate: 122.74 kb/s received > > Connnection Times (ms) > min avg max > Connect: 0 0 36 > Processing: 329 1263 2614 > Total: 329 1263 2650 > > > mysql_pconnect: > > /usr/local/apache/bin/ab -n 1000 -c 10 > http://192.168.1.2/~sheer/phpauction/index.php3 > > Server Software: Apache/1.3.12 > Server Hostname: 192.168.1.2 > Server Port: 80 > > Document Path: /~sheer/phpauction/index.php3 > Document Length: 15285 bytes > > Concurrency Level: 10 > Time taken for tests: 140.592 seconds > Complete requests: 1000 > Failed requests: 214 > (Connect: 0, Length: 214, Exceptions: 0) > Total transferred: 15584882 bytes > HTML transferred: 15288586 bytes > Requests per second: 7.11 > Transfer rate: 110.85 kb/s received > > Connnection Times (ms) > min avg max > Connect: 0 0 35 > Processing: 339 1398 2905 > Total: 339 1398 2940 > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net > For additional commands, e-mail: php-db-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.db (#3759) next »