Quicker way to save player data? -
Scenario - 28.11.2011
Sometimes a player's data doesn't get fully uploaded into the MySQL database because all of their data couldn't be retrieved before they actually disconnected from the server. I know that MySQL is a little slow when it comes to sending queries, therefore I thought about doing this:
I can extract the player's data and save it all into an INI file. Once the player actually disconnects from the server (i.e. a few seconds after saving the data into the INI file), I could extract the data from the INI file and send some threaded SQL queries and update the information in the database.
Would this be a good way to solve the problem described in the first paragraph? I cba. to do some speed-tests on this, and my knowledge of processing speeds for certain systems is limited.
Re: Quicker way to save player data? -
-Rebel Son- - 28.11.2011
thats an interesting method, indeed mysql querys are a tad slow, let me pm you in a bit, im gunna try to wright something up regarding this
Re: Quicker way to save player data? -
Scenario - 29.11.2011
... anybody got any ideas?
Re: Quicker way to save player data? -
Scenario - 30.11.2011
BUMP
Re: Quicker way to save player data? -
JamesC - 30.11.2011
How many times are you querying the database when the player disconnects?
Re: Quicker way to save player data? -
Lorenc_ - 30.11.2011
My server is located in the UK and I have about 40 + 48 columns that need to be saved. Works and saves it all fastly.
If you have a bad connection between your mysql database or a query which is un-optimized then yeah, it might be a bit slow.
Free your result after locating the players account!
And yes, I have 12000 rows (12000 accounts basically)
Re: Quicker way to save player data? -
TaMeD - 30.11.2011
I don't see why you don't just save everything to variables when the person disconnects, then query the mysql database with those variables
Re: Quicker way to save player data? -
leong124 - 30.11.2011
Quote:
Originally Posted by TaMeD
I don't see why you don't just save everything to variables when the person disconnects, then query the mysql database with those variables
|
I agree. Regularly saving the data into .ini files isn't good, as the file I/O is also quite slow actually.
Why not just make some arrays to store the data you want to access, and save them all into the database when the player leaves? This is much faster than storing everything into the large database and access them every time you want to get the data.
Unless your server is unstable, making real-time saving systems do no good to it.
Re: Quicker way to save player data? -
Scenario - 30.11.2011
I already have an enum for player data, so that isn't the problem.
I reviewed some of my previous code and what appeared to be happening was that I would do functions like "GetPlayerScore" after a few MySQL queries and it would of been too late, as the player would have left already and that function would not have processed.
I'm going to scratch the idea of using y_ini for saving, considering it may have been my coding causing the problems...
Thanks for all of the responses!