Re: Persistent Database Connections

From: Date: Tue, 26 Apr 2005 15:44:36 +0000
Subject: Re: Persistent Database Connections
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-213934@lists.php.net to get a copy of this message
Thanks, Philip (and Richard also), for offering your impressions. Per Philip's suggestion, I ran "ab" (Apache Benchmark) to stress test the page that loads my persistent connection. Depending on the parameters I set for ab, I was able to increase the number of connections from my initial 9 to anywhere between 15 and 25. This number varied from one test to another - even if I left the ab parameters the same. I probably could have boosted the total connections even further by raising the number of connections/requests initiated by ab. So, while I still don't have a rock-solid way to predict just how many connections will be opened for a given number of users, at least I'm not stuck at 9 :-) I guess it took using an automated approach to simulating server load (e.g., "ab") to force Apache to open additional connections to the database. Interestingly, I also observed during my testing that some connections opened by Apache were subsequently closed. So, this seems to answer my other question re. whether persistent connections stay open forever. I guess they don't. What seems clear is that Apache decides when to terminate active connections, not the database. Thanks again. Mike "Philip Hallstrom" <php@philip.pjkh.com> wrote in message news:20050425135720.L734@wolf.pjkh.com... >> What I am baffled by is the fact that the total nunber of connections >> between the web server and my database seems to max out at 9. Why 9? >> Not >> that I have a problem with this number. I just want to understand how >> this >> limit was reached so that I might predict how the application will >> perform >> in a production capacity. > > I can't think of a reason it would max out at 9 other than perhaps you > really don't have more than 9 connections open. My understanding is that > Apache will open a connection per child, per database connection where a > connection is made up of the host, user, and database. > > How many apache processes are running when you take this measurement? > There's no gaurantee that each of them will have hit your web app and > start up there own connection. > > You might use something like ab (apache benchmark) to hit a page that > initiates a persistent connection to see what happens as the number of > apache processes grows.

« previous php.general (#213934) next »