Closed RoboMWM closed 4 years ago
For now I am logging the IO. If the loading takes too long, MySQL should be used instead of the flatfile db anyways. I started a branch for async db loading. As it turns out I would have to change a lot to make that happen without a bunch of new issues.
If you insist on using SQL, then sqlite (or other flatfile storage options like H2) should be an option. I don't have any need to run a MySQL instance, especially since I only use this on a single server instance (and don't have any other plugin that requires a MySQL backend).
As it turns out I would have to change a lot to make that happen without a bunch of new issues.
This statements sounds like your MySQL queries aren't async? (They definitely should be, since they're not subject to just disk IO but network IO and any potential server overhead, whereas file access is (usually) contained within the same processes calling it.)
Also, minor critique, but unsure why you closed this if the issue still exists - it's in progress yes, but not finished. (Ok, well I suppose you did implement my suggestion of logging when db access is occurring, but that wasn't the primary issue.)
If you insist on using SQL, then sqlite (or other flatfile storage options like H2) should be an option. I don't have any need to run a MySQL instance, especially since I only use this on a single server instance (and don't have any other plugin that requires a MySQL backend).
I could, of course, add support for additional SQL DBs.
I'm assuming your MySQL queries are async? (They definitely should be.)
Sure they are.
I closed it for the "Would highly suggest printing out any file IO" part. But you are right, the async loading is not done yet.
Since iirc you're using ACF, you can also try another one of Aikar's tools, taskchain, to help execute code and pass data between sync and async threads.
I looked into taskchain a while ago and it is definitely a nice tool. Though for the moment I'll handle it in callback hell. I might find the time in the next months to start with a new major version. In that case taskchain will be used.
There's very little to setup (just a couple of static calls), I thought it'd be a lot but when I actually used it, it was much easier than doing callbacks, especially since it uses lambdas in the examples.
https://github.com/RoboMWM/MidnightPortal/blob/master/src/main/java/com/robomwm/midnightportal/MidnightPortal.java#L27 for setup and https://github.com/RoboMWM/MidnightPortal/blob/master/src/main/java/com/robomwm/midnightportal/PortalUtils.java#L84 for using.
Looking at the timings report you probably have a large data file, right? Could you send that to me so I can test with it?
That or the HDD is slow, could be either or both. https://hasteb.in/gatotubi.yaml from plugins/GameBox/data.yml
at 87KB.
Idk which part of the process is taking a long time, but if it's loading the YAML file, you could do something like a file per person, and load incrementally/asynchronously that way. There's also no reason to create entries for players that have never touched GameBox.
Thank you for the file.
The empty entries were fixed in #65. Although I probably should implement a clean-up to actively remove players that just have default settings and no stats.
Server log effectively freezes for around 20 seconds. There's no indication that Gamebox is the culprit, but fortunately timings helped find that out. Would highly suggest printing out any file IO, especially if on main thread... which this file IO should be on an async thread.
https://timings.aikar.co/?id=1deb4b544370438a88b9793d348920de
Version 2.2.4 as per plugins tab in timings.