-
-
Notifications
You must be signed in to change notification settings - Fork 637
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add SQL bindings to Lua API #3427
Comments
What about keeping sqlite for long term storage and adding redis for cache/in memory? |
Redis is complete overkill for 99% of all servers. Maybe implement it as option if the respective server owner wants to use that. |
Why do you think redis would be a "overkill"? Redis is easy to work with, has great performance, scales well and has a very tiny memory footprint (only 1MB!).
Also, there's still sqlite for mundane tasks. |
Sounds like a good idea. What other benefits would arise with the usage of Redis? |
The Redis site doesn't provide much of "integration developer" documentation - I have no idea on how to make Cuberite talk to Redis. As such, I already hate it :P Does Redis provide ODBC driver? If so, that would be the easiest way. |
sphinxc0re: the server could have distributed online stats updated in real time, like a better implementation of dynmap than dynmap's own: currently, if you want to offload the webserver from the minecraft instance you end up losing the real time goodness, like chat and map updating. This could be easily fixed by having the minecraft server and the webserver hitting the same redis instance or cluster. Nginx proxying helps offload some of the functions by serving the map tiles to clients but won't do a thing about chatting, players location etc. madmaxoft: I think you should look at the redis c++ clients...? http://redis.io/clients#c-- But hey each one has different use cases. I guess using ODBC would allow the user to switch from sqlite to mysql or any other SQL DBMS painlessly without the plugins even knowing, right? If so, this could replace the current sqlite API and let the users choose when they want to upgrade their database management software. That would be really awesome. Unrelated not unrelated: a redis server or cluster would allow multiple cuberite instances to access the same world simultaneously. There are some MMO games making use of this already. Having redis support built in would allow for a possible scenario where high performance plugins would scale seamlessly with a cuberite server cluster. EDIT: Looking back, I think I drifted away the purpose of this issue. Sorry. I should've opened a forum thread instead. |
I wonder if this would affect the way Cuberite handles MojangAPI, banlist, Ranks... sqlite databases. |
It won't be directly with this API. It's a bit separate change, but a related one indeed. So far I've come to the conclusion that two things are needed:
This way it will be possible to switch entire Cuberite to another data storage provider (including the built-in MojangAPI, banlist, ranks etc.) with a single configuration option. |
I would go without the odbc, because plugins at the moment can already use dependencies.... It's a bit of a hassle and may be improved but plugins should not be encouraged to make use of their own stuff while using some kind of sql through cuberite, either a complete datastore api or none. |
@Cl1608Ho's comment reminded me bukkit has something like this but nobody actually uses. |
@Cl1608Ho Are you suggesting writing our own database adapter with plugin specific migrations? That would be much more work than implementing ODBC |
Sorry for the wrong wording. Of course implementing ODBC, but rather not export it to lua because that would encourage plugins to use this exported function but their own database (and system) instead of letting cuberite handle the storage backend. Cuberite should offer an api where plugins can store and get data, maybe an interface for sql and nosql storage, and cuberite handles the backend (via ODBC of course....) |
I thought Redis is primarily for in-memory cache? (no disk storage) |
@LogicParrot redis has persistency enabled by default but one may disable it. Take a look. redis would be helpful if (and maybe only if) there was a way to split a cuberite server into multiple instances (clustering), to keep everything in sync et al. In this scenario persistence could be disabled, since data would be stored elsewhere and redis would be used to “glue" servers on runtime. |
So which one’s gonna be? |
I still think there are still some open questions about the implementation.
I think this is really important so we can integrate Cuberite with existing spigot servers or other cuberite instances. For instance, one could make an authme-compatible plugin that reads and writes from the same database, make shared inventories, etc. |
Reddis? PostgreSQL? Overkill. Overkill. Overkill :P In my humble opinion, keep it simple and stay with Sqlite. I think we should prioritize being on par with others in other aspects before adding bells and whistles. |
The lack of MySQL really kills it when you have a Bungeecord network where you want to sync permissions, login, economy and/or other player data across multiple servers (possibly mixing up Cuberite with other server software like Spigot, Glowstone…). A simple lobby sitting there doing “nothing” uses almost no resources on Cuberite (as you would expect) but god help if you dare use Spigot. IMO people would transition gradually to Cuberite if there are conditions to do so. I have to agree with Redis and PostgreSQL being overkill though. |
Using priority labels would be a good deal perhaps? |
My opinion would be to implement the database with SQL (vs nosql) and let the config file decide whether to use postgres, mysql or sqlite (default) using an ODBC string. About your questions @yangm97
|
@Cl1608Ho I agree mostly with what you said but: 1.2. I think this essentially blurs the line between the “datastore API” and #1395. I know the datastore API was meant to be way more complex than that (abstracting SQL completely) but I’m starting to think this is a way more viable solution (mostly due its simplicity). So I guess there is no need to open an issue for the “datastore API”, just renaming the helper SQLite issue to just SQL. |
There are more and more requests to have SQL bindings available to the plugins.
Although already solvable using LuaRocks (and possibly other Lua package managers), it would be much better to include the API already in Cuberite itself.
In my opinion the easiest way to do that would be to use ODBC - it is supported out of the box on Windows and is a single dependency on Linux. This would keep compilation easy, with only one additional dependency on Linux.
As for the API, the basic one should work about the same as the current SQLite API - open DB, prepare a statement, execute statement, iterate over results. However, since these DB engines may have a much higher lag than SQLite, it would be advisable to provide also asynchronous API - open DB, prepare a statement, schedule statement for execution, provide callback for the returned data. For this, Cuberite would need a scheduler thread(pool) onto which the SQL statements (and later possibly other stuff) could be scheduled.
The text was updated successfully, but these errors were encountered: