Does Magic Suppot MySql?
pianwan opened this issue · 6 comments
I want to use this plugin in a bungeecord server and sync the data across the bungee servers.
How to do that?
There is no built in MySQL support. Your options are to write your own player data storage extension, or if you are able to set up a NAS or other solution where the servers can share a player data folder (via mounted network drives) that can work too, though it’s not really directly supported.
MySQL has the merits of high IO efficiency.
But yaml file doesn't have.
It may cause some lag in a large server network.
Could you add MySQL support in the future?
I highly doubt that one can get any performance gains from moving from files to a database when all it does is store a chunk of yaml-encoded text. If you have data to prove me wrong I would love to hear it.
All file I/O operations are done asynchronously. There really wouldn't be a big performance gain here- a file system is basically a K/V database, if I were to move this to MySQL I honestly would not expect any performance improvements. None of it should really be noticeable anyway, the only thing a slow data load would mean (be it MySQL or file I/O) is it takes a little bit longer for a player to be able to cast spells on login. Most players won't notice at all.
MySQL would mainly be a more consistent way to share data.
Potential performance gains aside (I am also dubious) I do agree it's a more appropriate way to store data across a server network.
However, this has been on the todo list for, literally, a few years now so I would not anticipate it happening anytime soon. It's something only a very limited subsection of users require, and most of them seem to fall into two groups so far:
-
OK with a shared-folder solution, which now works pretty well mainly thanks to one persistent user who forced me to iron out all of the bugs, using a file-locking mechanism to communicate when files are done saving and ready to load.
-
Has their own core system already storing player data and would like to simply integrate magic player data into that. They have a dev willing to do a little bit of work (there is an API for this so it's really not that hard) to just push and pull the data they need.
If I were to make a mysql data storage mechanism built in, I'd want to do it in a very certain way that would be a little complex to get right, and once done would be a huge pain to ever change (having to migrate anyone's data who has used it). Like killme said it's primarily be a K/V store just like the yaml solution, but ideally I would want to separate out undo queue information in an accessible relational format, so I could use it like LogBlock, or make a version of Rollback that works for magical griefing even when the offending player is offline, that sort of thing. So this would take a bit of thought in terms of how to do it cleverly and efficiently.
It's certainly something I would like to do, but the balance between gain versus time consumed just isn't there. I don't get to work on this plugin much anymore, honestly just chasing bugs keeps me pretty busy (sadly), so any time beyond that I'd prefer to work on new features that would be exciting to most people, versus just useful to a select few.