Hi,
We use mysql on the back end on our system. We have many long running jobs (processing videos etc) and during the time these long running jobs are actually running we see a database connection being held open to our database server. It's causing us some problems as we scale.
I know in the old days of my PHP programming (pre Laravel) the connection to the database would stay open for the duration of the script and then exit. That is great for quick web hits, etc.
However, with these long running jobs (that sometimes can run for 1-2 hours or longer) it's a problem.
I wanted to see if someone could explain to me how the database connections work and if there is a way for me to somehow force the connection to get released or if you have any ideas on this, maybe it would time out or something and then when a model is called that needs data it would get a new connection?
Edited to add: There is a while (true) { sleep(2); } in my long running jobs that does the video processing. Possibly prior to that while loop being called I can disconnect from the database and then when the long running process ends I can reconnect to the database as the remainder of the job does indeed connect to the database and update date.
Thanks for your help.
-Rob