-
Notifications
You must be signed in to change notification settings - Fork 50
Add profile cache #368
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
base: master
Are you sure you want to change the base?
Add profile cache #368
Conversation
The SQLite exact online should be fine(tm) to use on the main thread.
Bit torn on queries being inline rather than all declared at the top of the file. I feel like it looks less clean, but also I kept having to scroll up and down to see which index was which.
Should probably autoformat this whole thing, but eh. Some of it is even uglier autoformatted.
Whoops
These are not official API for now, and likely won't be until OI v6, which is still a ways out.
Helps reduce the risk of data loss during high activity.
Helps to have the UUID bits in the correct order, I'm told.
|
I've tested this and it appears to be working correctly. There are a couple of things I'm not super thrilled with at the moment.
/e: Actually this is a pretty large problem because it means that the import process might leave a lot of stuff hanging depending on timing. In general, importing should probably bypass the normal batch gather and potentially do its own batching. I had wanted to create a more general solution, but getting slightly more specific seems smarter. |
This was previously guaranteed, but we may want to eventually move to the LookupProfileEvent for Paper. Alternately, maybe the profile store should revert to returning an ordered collection of best to worst match.
|
@R00tB33rMan I'd appreciate your input if you have the time. I think this is about ready on my end. I do only have access to about 4k user files, but everything seemed pretty smooth. The import took 62s, largely due to the I/O speed of the HDD I store my test server on. After that, lookup performance was really solid, fractions of a second. |
|
Hey, @Jikoo! I had a good look at this, and as far as I'm concerned, nothing pops out to me from reviewing the last 6 minutes or so and compiling locally. (And of course, no errors)! I'd argue that this is probably a good start, and once you refine any other to-dos, it should be good to go! |
Trades a relatively small amount of disk space (about 50 bytes per player) and additional async processing post-login (which is generally a hot area for plugins already) in exchange for not relying on the server's user cache or having to load every single player from disk to check their name.
There is one behavioral change here - for the SQLite implementation, I opted to require the first character to match (case-insensitive) as it provides a massive speedup to the already-much-faster query.
TODO:
Consider refactoring JdbcProfileStoreConsider refactoring importer to allow importing from arbitrary other implementationsConsider adding a method to get profile by UUIDConsider adding profile expirationIt may be a good idea to optimize the JaroWinkler implementation in a future PR - that's likely the largest bottleneck now.