SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 12/08/2017, 01:02 PM   #1
dicknyson
Big Clucker
 
dicknyson's Avatar
 
Join Date: Feb 2016
Location: England
Posts: 50
Reputation: 5
Default MySQL slows down after server restart

I'm loading 86 houses from a MySQL table. Exterior xyz, interior xyz, interior id, price, owner's name. It's been this way for years since I first coded it, and it's never had any problems. Loads the data into an enumerator, creates the pickups and 3d text labels, and then it's done. I haven't changed any of the code or changed the database in any way since probably last year.

When I first start the server, it takes around 1.5-2.5 seconds to load the houses. However, if I use /rcon gmx, or my /restart command (which saves player data first, then runs the gmx command), the houses start loading but take around 45 seconds to finish loading, and during this period, nothing else that uses MySQL works, for example user accounts won't load so the player will just be stuck trying to spawn but being unable to because they aren't logged in. Then, when the houses load, everything starts working perfectly.

I also noticed that if I close the server .exe while the houses are taking ages to load then boot it again, it still takes ages unless I wait for around 45 seconds before rebooting.

This has never happened before until about a week ago when I decided to boot up the server for old times. Any ideas?
__________________
http://sf-se.net
dicknyson is offline   Reply With Quote
Old 13/08/2017, 06:18 AM   #2
Storm94
Little Clucker
 
Join Date: Dec 2012
Posts: 26
Reputation: 0
Default Re: MySQL slows down after server restart

Probably has something to do with not clearing the MySQL cache...you said this was an old gamemode, is it old enough that it isn't using threaded queries?
__________________
USA Trucking! - http://usa-trucking.net
play.usa-trucking.net:7777
[Insert Banner Here (I don't have one yet )]
----
Stop the abuse of the "stock" keyword! http://forum.sa-mp.com/showthread.php?t=570635
Storm94 is offline   Reply With Quote
Old 13/08/2017, 09:12 AM   #3
Vince
Spam Machine
 
Vince's Avatar
 
Join Date: Sep 2007
Location: Belgium
Posts: 11,045
Reputation: 2647
Default Re: MySQL slows down after server restart

Quote:
Originally Posted by dicknyson View Post
When I first start the server, it takes around 1.5-2.5 seconds to load the houses.
That already seems way too long for that little amount of rows.

Do you properly close the connection on exit?
__________________
Vince is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
This Slows The server Opah Scripting Help 8 09/07/2013 10:47 AM
Mysql PVars reset when server restart:s Admigo Scripting Help 3 01/04/2013 05:47 PM
MySQL not loading on server restart dthompson Scripting Help 7 12/02/2013 11:47 PM
MySQL - server is crashing when player connects after restart Chriham3 Scripting Help 0 31/12/2012 01:20 AM


All times are GMT. The time now is 05:40 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.