Connecting Tech Pros Worldwide Forums | Help | Site Map

mysql_pconnect() Do persistent connections ever die?

Randell D.
Guest
 
Posts: n/a
#1: Jul 20 '05

Folks,
I currently connect to my db with PHP code that uses non-persistent
connections. I've read that persistent connections can help performance
since a connection to the db will use an existing unused connection.

If my system was to go through a busy period whereby I seen an extra 50% or
more activity for ten minutes or so, would the extra connections stay alive
for ever or is there a time limit of inactivity?

Would the unused connections just sleep if they don't die? Is there any
negative effect of having these connections waiting around?

Thanks - all help via the ng would be much appreciated...

--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet?



RavenMaster
Guest
 
Posts: n/a
#2: Jul 20 '05

re: mysql_pconnect() Do persistent connections ever die?


It all depends on the database you are connecting to and its configuration.
Many databases will kill inactive threads after a defined unit of time. You
can also configure the max number of connections on many databases as well.

The negative effect of unused connections is wasted resources (memory).
There is a threshold where too many connections can cause problems. It all
depends on your database, OS, and hardware.

Tuning your database and good database design can go a long way in enhancing
performance of your PHP application.

/dkm



"Randell D." <you.can.email.me.at.randelld@yahoo.com> wrote in message
news:qakhb.54953$9l5.45409@pd7tw2no...[color=blue]
>
> Folks,
> I currently connect to my db with PHP code that uses non-persistent
> connections. I've read that persistent connections can help performance
> since a connection to the db will use an existing unused connection.
>
> If my system was to go through a busy period whereby I seen an extra 50%[/color]
or[color=blue]
> more activity for ten minutes or so, would the extra connections stay[/color]
alive[color=blue]
> for ever or is there a time limit of inactivity?
>
> Would the unused connections just sleep if they don't die? Is there any
> negative effect of having these connections waiting around?
>
> Thanks - all help via the ng would be much appreciated...
>
> --
> A: Because it messes up the order in which people normally read text.
> Q: Why is top-posting such a bad thing?
> A: Top-posting.
> Q: What is the most annoying thing on usenet?
>
>[/color]


Richard Podsada
Guest
 
Posts: n/a
#3: Jul 20 '05

re: mysql_pconnect() Do persistent connections ever die?


"Randell D." <you.can.email.me.at.randelld@yahoo.com> wrote in
news:qakhb.54953$9l5.45409@pd7tw2no:
[color=blue]
> I currently connect to my db with PHP code that uses non-persistent
> connections. I've read that persistent connections can help
> performance since a connection to the db will use an existing unused
> connection.[/color]

Can I point you to the PHP manual page on Persistent Connections?

http://ca3.php.net/manual/en/feature...onnections.php

This is a pretty good article covering the ups and downs of persistent
connections, and things to look out for. They've written it all out for me
so no need to say it here :)

--
Richard

Richard Podsada
Guest
 
Posts: n/a
#4: Jul 20 '05

re: mysql_pconnect() Do persistent connections ever die?


"Randell D." <you.can.email.me.at.randelld@yahoo.com> wrote in
news:qakhb.54953$9l5.45409@pd7tw2no:
[color=blue]
> I currently connect to my db with PHP code that uses non-persistent
> connections. I've read that persistent connections can help
> performance since a connection to the db will use an existing unused
> connection.[/color]

Can I point you to the PHP manual page on Persistent Connections?

http://ca3.php.net/manual/en/feature...onnections.php

This is a pretty good article covering the ups and downs of persistent
connections, and things to look out for. They've written it all out for me
so no need to say it here :)

--
Richard

Andy Hassall
Guest
 
Posts: n/a
#5: Jul 20 '05

re: mysql_pconnect() Do persistent connections ever die?


On Fri, 10 Oct 2003 03:06:00 GMT, Richard Podsada
<jslweb@superduperspamdiedietelusplanet.net> wrote:
[color=blue]
>"Randell D." <you.can.email.me.at.randelld@yahoo.com> wrote in
>news:qakhb.54953$9l5.45409@pd7tw2no:
>[color=green]
>> I currently connect to my db with PHP code that uses non-persistent
>> connections. I've read that persistent connections can help
>> performance since a connection to the db will use an existing unused
>> connection.[/color]
>
>Can I point you to the PHP manual page on Persistent Connections?
>
>http://ca3.php.net/manual/en/feature...onnections.php
>
>This is a pretty good article covering the ups and downs of persistent
>connections, and things to look out for. They've written it all out for me
>so no need to say it here :)[/color]

Unfortunately it says nothing about timeouts; dropping connections that have
been unused for a configurable amount of time would seem to be a useful
optimisation for PHP persistent connections, but there doesn't appear be a
PHP-side facility for this.

--
Andy Hassall (andy@andyh.co.uk) icq(5747695) (http://www.andyh.co.uk)
Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)
Andy Hassall
Guest
 
Posts: n/a
#6: Jul 20 '05

re: mysql_pconnect() Do persistent connections ever die?


On Fri, 10 Oct 2003 03:06:00 GMT, Richard Podsada
<jslweb@superduperspamdiedietelusplanet.net> wrote:
[color=blue]
>"Randell D." <you.can.email.me.at.randelld@yahoo.com> wrote in
>news:qakhb.54953$9l5.45409@pd7tw2no:
>[color=green]
>> I currently connect to my db with PHP code that uses non-persistent
>> connections. I've read that persistent connections can help
>> performance since a connection to the db will use an existing unused
>> connection.[/color]
>
>Can I point you to the PHP manual page on Persistent Connections?
>
>http://ca3.php.net/manual/en/feature...onnections.php
>
>This is a pretty good article covering the ups and downs of persistent
>connections, and things to look out for. They've written it all out for me
>so no need to say it here :)[/color]

Unfortunately it says nothing about timeouts; dropping connections that have
been unused for a configurable amount of time would seem to be a useful
optimisation for PHP persistent connections, but there doesn't appear be a
PHP-side facility for this.

--
Andy Hassall (andy@andyh.co.uk) icq(5747695) (http://www.andyh.co.uk)
Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)
Closed Thread