472,984 Members | 2,310 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,984 software developers and data experts.

mysql_pconnect() Do persistent connections ever die?


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?
Jul 17 '05 #1
3 2735
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." <yo**************************@yahoo.com> wrote in message
news:qakhb.54953$9l5.45409@pd7tw2no...

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?

Jul 17 '05 #2
"Randell D." <yo**************************@yahoo.com> wrote in
news:qakhb.54953$9l5.45409@pd7tw2no:
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.


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

Jul 17 '05 #3
On Fri, 10 Oct 2003 03:06:00 GMT, Richard Podsada
<js****@superduperspamdiedietelusplanet.net> wrote:
"Randell D." <yo**************************@yahoo.com> wrote in
news:qakhb.54953$9l5.45409@pd7tw2no:
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.


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 :)


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 (an**@andyh.co.uk) icq(5747695) (http://www.andyh.co.uk)
Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)
Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Derek Fountain | last post by:
For a low-ish traffic website that is doing the simple "build pages from HTML templates and info in a database" kind of thing, do the wise folks in this newsgroup advocate connecting and...
0
by: anders thoresson | last post by:
Hi, I have this function I call everytime I need to make a query from within my php-scripts: function db_connect ($user, $pwd, $db, $debug = 0) { $link = @mysql_pconnect("localhost",...
5
by: Randell D. | last post by:
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...
4
by: OneSolution | last post by:
Coming from a java background, I've been taught that connection pooling is the best thing due to the obvious benefits. I found out that the above pconnect() function will pool connections. So...
4
by: Angelos | last post by:
I get this error mysql_pconnect Too many connections ... every now and then. Does anyone knows where it comes from ? There are a lot of sites running on the server and all of them use the...
1
by: WhatsPHP | last post by:
Can I use mysql_pconnect on an environment like this? There is just 1 server on which both PHP and MYSQL runs. It is an intranet server. At any point atleast 2 people will be actively using the...
11
by: =?ISO-8859-1?Q?J=F8rn?= Dahl-Stamnes | last post by:
Hello, I have been using mysql_connect in a script that display a lot of thumbnails for an album. Each thumbnail is displayed using the code: <IMG SRC="thm.php?id=some_id" ALT="some title"> ...
4
hsriat
by: hsriat | last post by:
Got an issue regarding this... As said above (same as what php.net says), if we use mysql_pconnect(), it doesn't create more connections, if the connection parameters are same as the existing...
9
by: John Murtari | last post by:
Folks, We have a fairly busy web site present using PHP 5 to talk to a MySQL 5.0.45 DB on an Apache 1.3 series server. It's spread out over several physical hosts (one DB server), we use DB...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.