I am developing a plugin that uses a mysql connection. Only problem is that the connection times out after 8 hours. Which is better, start and stop the connection for every request or just remove the timeout limit for mysql database?
Well it's probably a good idea to refresh the connection every so often.. however you don't want to disconnect / reconnect every time you call for the database for stability reasons. I mean there are several ways to go about this its really just what you want to do. Btw my AH sponsors one of my plugins
Well you could have an Integer and every time you call to the DB ++ the int and check it's number and lets say if the int == 50 then refresh the connect and set the int to 0... that way it will refresh every so often. Then again 50 is a large number and it just depends on how many times your calling to the DB.
I'd say the database is referenced every few seconds, I could have a scheduler add 1 to the database every so often for those few times when the database is rarely referenced.
If your going to run a scheduler may as well run a repeating one and evey 30 minutes or so refresh the connection