I recently installed a trial version of Interbase on a development server
that includes a nifty tool that allows me to monitor, among other things,
the number of active connections to my server.  After playing with this
feature briefly, I noticed that SEVERAL connections are opened between my
web server and the database.  At first, I thought this was a little weird
because I use the ibase_pconnect() function to establish communication with
my database, and I expected to see only 1 connection.  However, after doing
some reading, I discovered that this behavior is probably by design - the
result of Apache spawning several child processes, each one establishing its
own persistent connection(s) to the database.

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.

I have checked my Apache config (httpd.conf) file, and as far as I can tell,
the maximum number of child processes is set to 20.  So again I ask: why
does the number of connections max out at 9?  Shouldn't they max out at 20
or 21 (1 parent + 20 children)?

Not necessarily (see above). It could very well be that for 20 children you could have *more* than that number of connections if your web pages connect to multiple databases...


And finally, I have noticed that the connections, once established, NEVER
expire.  I realize that this is sort of the point with persistent
connections, but I was curious whether persistent connections are ever
terminated or recycled.

I don't think so. I suppose the database could kill lingering connections... I don't know about that.


What I've done in the past is to set the number of requests each apache child is allowed to serve to some number that will be reached on some reasonable frequency. Then it closes that child which closes the connections...


Any explanations/impressions would be appreciated.

Mike

FYI... My php.ini file is set to allow unlimited connections/unlimited
persistent connections.  Also, the trial license of the database I am
testing claims to be limited to 1 client, and the only client accessing the
database is my web app.  Just thought I'd mention that as I don't think the
number of connections has any direct correlation to the client license.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to