So I have this VPS server with decent stats on it (Tier 3 VPS @ Hostgator) and when I put the database under strain (at least that’s when I presume it happens) I periodically receive this response “MySQL server has gone away”.
From my Googling this problem seems to be a time out issue, but I don’t understand how that can be possible when I’m under the impression that this error only occurs when the machine is actually under stress.
I should also mention I’m doing a series of fopens in PHP to read information from a file and store in the database. The scripts that get these errors are the ones that run automatically under cron under root.
Are you reading the info from a file, storing it in the database then moving onto the next or are you reading the info from each file in turn then storing all the info from the files in the db in one hit?
I’m reading the info from an RSS page, storing bits of rss data and then moving onto the next item usually in the RSS feed. Depending on what the script decides it may also visit a URL just to ensure the link is still relevant, if this happens it will also mark this down as a record in the database. It’s basically like a sports news ticker.
As for it doing it all in “one hit” I guess I need clarification on what one hit actually means. What I have described above will happen multiple times (maybe 100+) on one cron script run. If the script runs the above 100 times there is probably anywhere between 200-400 database queries and this Script runs every minute.
My understanding of MySQL is that it should easily be able to handle something like this. Am I over estimating it’s capabilities?
No, that’s a good idea. The only problem with presenting problems to Hostgator is that they obviously want to re-create the scenario in which the error shows, this is tough to do with a Cron’d script and their tier 1 basic tech support guys really aren’t all that skilled when it comes to stuff like this. It ends up being a huge hassle but if need be I will end up trying to get support from them.
More or less I just wanted to see if this was actually a common problem. It doesn’t appear that it is.
I should also note I don’t write very “effecient” SQL code, I’m well aware of it, but my understanding of poor SQL coding only translates into slow responses, not “no” responses altogether. This is a whole new ball game for me now.