? Best moments to save player's data

Started by Sebastian, May 28, 2017, 04:52 PM

Previous topic - Next topic

Sebastian

I've seen numerous ways of saving data: some good, some worse
But which one would actually be the greatest ?
(making almost imposible to lose any data by a crash or anything else)

.

It all depends on the cost of saving the data.
.

EK.IceFlake

Save it on-demand to 6 MySQL servers all hosted on different continents.

KAKAN

Quote from: EK.IceFlake on May 28, 2017, 05:18 PMSave it on-demand to 6 MySQL servers all hosted on different continents.
redundancy, one word for your whole sentence xd
oh no

NicusorN5

When the player is using a cmd, or is getting killer I think.

Sebastian

No one likes to lose things for dumb reasons... so the database must be saved frequently.
But when actually ? without lagging

onPlayerPart ?
onPlayerSpawn ?
saving it at an interval of 20mins ?
onPlayerDeath ?

DizzasTeR

onPlayerPart is fine.

:edit: Before any dumbass shows up and says "WHAT IF SERVER CRASHES HUH? HUH? HUH?!!?!!?!? Then just remember to fix your broken scripts so it doesn't crash.

NewK

#7
On the CTF (5.0) server, I save it on the exact moment when there's changes to make. For example OnPlayerKill. Whenever there's a kill, I save it on that exact moment to the DB. This would usuallly lag the server, but I do it on a different thread, so it doesn't.

I have a thread pool system in place for every time I need to interact with the DB. All DB interactions are made on a different thread so it doesn't lagg the server. Also doesn't matter how frequent DB changes happen because I can limit the amount of threads on my thread pool and I can also set the time limit for which the threads may remain idle before being removed from the thread pool. I can control all of this while the server is running with IRC commands.

You can't really do any of this on the squirrel plugin though, I use the Java plugin so that's why this is possible. This is in my opinion the biggest advantage the Java plugin has. The ability to manage threads and do whatever you want asynchronously if you ever need to. Squirrel users are missing out on alot of great stuff by not using the java plugin.

Sebastian

I've heard a lot of good things about java plugin, PLENTY of advantages.
Seems like you got one BIG enough to proof it's worthy.

But I'm still using Squirrel, and learning java is not worthy for me as it won't be needed in my profession.
Scripting is just fun for me, and I had alot by doing it in vcmp, with squirrel.

Right now I'm kinda working on something that might be my last project in vcmp, and I'm really wondering what (and when) you guys suggesting to save the data, to keep it updated as frequently as posible, and in the most economic/not-lagging way.
I wanna hear the best suggestions you've got.

Truly thank you for your answer!

.

Quote from: Doom_Kill3R on May 28, 2017, 07:28 PM...Then just remember to fix your broken scripts so it doesn't crash.

What if the server itself crashes? Not something rare here.
.

kennedyarz

@sseebbyy, just do this. Make an Autosave function in your script. Then set a function like NewTimer but not NewTimer. Make it work with OnTimeChange that is saved every 10 seconds and also set Autosave () on OnPlayerPart; And you will not have problems.

DizzasTeR

Quote from: . on May 28, 2017, 08:10 PM
Quote from: Doom_Kill3R on May 28, 2017, 07:28 PM...Then just remember to fix your broken scripts so it doesn't crash.

What if the server itself crashes? Not something rare here.

It doesn't crash itself. Atleast mine doesn't.

PunkNoodle

My 2 cents, save when onPlayerPart and also with an interval of 15 or 30 mins for example. In this way if the server crashes you'll lose only half an hour of data maximum (if you chose 30 mins interval). The operation of saving to a database each interval isn't a lag-causing operation itself that mostly depends on how optimised are the scripts.

Sebastian

#13
@PunkNoodle Yes, I will probably keep doing that.

Sebastian

I will add a poll to this topic, to see which variant îs the Best of Best.
But first, what variants should appear? 

One for sure should BE:
onPlayerPart + 25mins interval