|
|
Joined: Aug 2000
Posts: 3,590 Likes: 1
Moderator
|
|
Moderator
Joined: Aug 2000
Posts: 3,590 Likes: 1 |
I just recieved a threatening email from my host []/w3timages/icons/shocked.gif[/] . It says that recently my web site is leaving too many open connections in MySQL.
| 596 | xalliance | localhost | xalliance | Sleep | 9925 | | |
I havent done much lately with my site except for the addition of this message board. I was wondering if this is a bug in the message board or possibly the result of the login / logout procedure.
I guess I sorta doubt that this board would have a flaw such as this but I thought I would ask before going through all of "my" code []/w3timages/icons/frown.gif[/]
|
|
|
|
|
Joined: May 1999
Posts: 3,039
Guru
|
|
Guru
Joined: May 1999
Posts: 3,039 |
You probably need to turn persistent connections off in the config file. Take a look at config.inc.php and turn the $config[persisten] variable off and this should get rid of the open connections.
UBB.threads Developer
|
|
|
|
|
Joined: Jan 2000
Posts: 796
Addict
|
|
Addict
Joined: Jan 2000
Posts: 796 |
Maybe you could inform a little more on what does this really means as most of us will have no idea what this really implies (the config file just only says some hosts dont allow it), explain why, advantages vs. disadvantages in having this on. I for example have it on, I guess it was the default. Right now my public is going to the perl version as I adapt the php one, but would this be something you would turn on if you have thousands of users but not if just a few? Give us info on this so we know what to choose. []/w3timages/icons/wink.gif[/] Mateo Byler CruceDeCaminos.com
|
|
|
|
|
Joined: May 1999
Posts: 3,039
Guru
|
|
Guru
Joined: May 1999
Posts: 3,039 |
Ok. I'll explain it this way. Under non-persistent connections every time you request a wwwthreads page the script has to make the connection to the sql server, connect to the database and then disconnect when finished. Meaning basically a connection is only made to the SQL server when needed. Natually, there is a bit more overhead in doing this.
Under persistent connections, once a connection is made to the database it remains open. This connection is available for all subsequent requests that WWWThreads make. No overhead for connecting/disconnecting for each script.
So, the second way, using persistent connections is faster. But here is the drawback. A connection is left open for every webserver processes that runs one of the wwwthreads scripts. On a typical system you may have anywhere from 10 to a couple hundred webserver processes running. And during the course of your browsing session you will hit a wide variety of those webserver processes. So, if you hit one that doesn't have a connection open to the db it connects and then leaves it open. So, as you can see after a while you may have a mysql connection open for every webserver process running. Isn't a big deal if it's your own system, but if this is a shared server then they probably wouldn't like this too much.
UBB.threads Developer
|
|
|
|
|
Joined: May 1999
Posts: 41
Power User
|
|
Power User
Joined: May 1999
Posts: 41 |
Thanks for that info Scream. I wondered how that worked. One thing that is even more puzzling..... Can't hosting company turn off persistant connections? in the PHP INI? So far my host has not told me to turn them off and its a virtual account. I assumed since they allowed them they would not get upset if I used them. http://www.clickteam.com
|
|
|
|
|
Joined: Jan 2000
Posts: 796
Addict
|
|
Addict
Joined: Jan 2000
Posts: 796 |
...and... are they really, really persistent? That is, keeping the connections open even after say, 5 minutes, 10 hours or 5 days... of not ussing that specific connection? I gather that your recommendation would be for sites with less than 100 pageviews per hour to turn it off as it wouldnt really be worth it... or could you give us a pageviews general recommendation number? []/w3timages/icons/wink.gif[/] Mateo Byler CruceDeCaminos.com
|
|
|
|
|
Joined: May 1999
Posts: 3,039
Guru
|
|
Guru
Joined: May 1999
Posts: 3,039 |
Yes, this can be turned off in the PHP ini file I believe.
UBB.threads Developer
|
|
|
|
|
Joined: May 1999
Posts: 3,039
Guru
|
|
Guru
Joined: May 1999
Posts: 3,039 |
They stay persistent as long as the webserver process stays alive. Normally a webserver process will only stay alive for so many requests (all depends on the server setup), and then the process is killed and a new one is spawned. When the process is killed the corresponding mysql connection is killed as well, until the new webserver process needs a connection.
As for a recommendation, I'm not too sure. If you have a very steady stream of traffic with some noticeable slowdown during heavy useage then it might help to turn this on but on average use I don't think you'd need it. Sorry I can't be more specific, because I'm really not sure[]/w3timages/icons/smile.gif[/].
UBB.threads Developer
|
|
|
Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.
Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
|
|
Posts: 449
Joined: February 2008
|
|
|
Forums63
Topics37,583
Posts293,955
Members13,826
| |
Most Online151,614 Nov 14th, 2025
|
|
Currently Online 13812
Topics Created 0
Posts Made 0
Users Online 1
Birthdays 12
|
|
|
|