Mysql constantly losing connection/timing out on requests

Connect with other users about what to run on your webhosting (and how to run it) here.
Post Reply
Jerpy
A regular
A regular
Posts: 37
https://www.youtube.com/channel/UC40BgXanDqOYoVCYFDSTfHA
Joined: Fri Jan 30, 2015 10:08 am

Mysql constantly losing connection/timing out on requests

Post by Jerpy »

It's extremely noticeable on the forums, but not so much in-game. Both however, do time out extremely often. In game, the request simply just takes longer if this is the case but console will let me know if a request timed out and it will restart it. This does not bother me whatsoever since it is a very very minor inconvenience and simply adds on a small amount of time to a request that won't really be affected if that is the case. You don't notice it in game at all, basically, but its there.

As for web, its very easy to spot this. As we all know, most if not all forums pretty much completely run all information off of the mysql tables, so it's going to be sending various requests to retrieve this information. Mine times out 50% of the time someone is trying to load another page. The server error log is filled with connection timed out errors, and if I didn't clear the log at least once every 2 days, it would probably be at 80+ pages right now.
When I say noticeable, it just means sometimes the page takes much much longer to load all information from the database, or sometimes it just gives up overall and doesn't even display the information. A strong example of that second one would be the shoutbox/chatbox. It doesn't seem to send multiple requests if they all time out, so it just stays blank unless you refresh the page and try again.

Here is an example of the server error log
Image
It's never empty.

I don't know if this is something that is a default for NFO, or not. I say this because some various webhosts do not allow connections for extended times such as that, and close them if this happens, and will spit out a timed out error. I don't know if this is the case, but I'd prefer it not to be.
I've had the lite webhosting plan for about 4 months now, and I can say I'm not disappointed at all, its just this one minor thing that's slightly annoying me.
User avatar
Edge100x
Founder
Founder
Posts: 13113
Joined: Thu Apr 18, 2002 11:04 pm
Location: Seattle
Contact:

Re: Mysql constantly losing connection/timing out on request

Post by Edge100x »

For the website portion, do you accidentally have it connecting to anything but "localhost"? MySQL rate-limits other connections, most likely.

Make sure that your shoutbox does not refresh more often than every 30 seconds, as well.

Our MySQL servers themselves are very stable, with long uptimes all around.
Jerpy
A regular
A regular
Posts: 37
Joined: Fri Jan 30, 2015 10:08 am

Re: Mysql constantly losing connection/timing out on request

Post by Jerpy »

Edge100x wrote:For the website portion, do you accidentally have it connecting to anything but "localhost"? MySQL rate-limits other connections, most likely.

Make sure that your shoutbox does not refresh more often than every 30 seconds, as well.

Our MySQL servers themselves are very stable, with long uptimes all around.
Well, as of replying to this post I have fixed this. It hit me when I was reading a completely unrelated thread on a different forum about some query settings for sourcebans, when someone had mentioned "be sure if its being hosted on the same machine, use localhost" And I can guarantee you I've seen this before, but for whatever reason it hasn't hit me until now that I have been using my remote address on accident for all of my web-side mysql when I could have been using localhost.
Woops.
This was discovered a few hours after this post was made, and I went through and changed everything to localhost that is on the webhosting machine, and sure enough, no more errors, and much much faster performance. So yes, it was indeed an address issue. Problem solved.
User avatar
Edge100x
Founder
Founder
Posts: 13113
Joined: Thu Apr 18, 2002 11:04 pm
Location: Seattle
Contact:

Re: Mysql constantly losing connection/timing out on request

Post by Edge100x »

I'm glad to hear that it was a (relatively) easy fix!
Post Reply