Open rbos opened 1 year ago
Hey, thank you for reporting this. Can you please provide some more information such as your database file (data.yml) or whatever format you use. Can you also put "ep debug" into the console and send the output or a screenshot? I'd appreciate this so I can understand what is happening here.
Hello.
Using MySQL on a separate VM. 9685 lines in the economy table. UUIDs enabled.
/ep debug: I tried updating to 4.9 but it didn't resolve the /baltop issue, in fact had much worse performance issues.
[08:24:04 INFO]: +------------------------------------+
[08:24:04 INFO]: EconomyPlus
[08:24:04 INFO]: Debug
[08:24:04 INFO]:
[08:24:04 INFO]: -> MC-Version of the server: 1.19.3-R0.1-SNAPSHOT
[08:24:04 INFO]: -> Version of the plugin: 4.3.1
[08:24:04 INFO]: -> Version of the config: 4.9
[08:24:04 INFO]:
[08:24:04 INFO]: -> Database: MySQL
[08:24:04 INFO]: -> Storage-mode: UUID
[08:24:04 INFO]: -> Messages file: EN
[08:24:04 INFO]:
[08:24:04 INFO]: -> Server software: Paper
[08:24:04 INFO]: -> Software version: git-Paper-384 (MC: 1.19.3)
[08:24:04 INFO]: -> Vault Version: 1.7.3-b131
[08:24:04 INFO]:
[08:24:04 INFO]: -> PlaceholderAPI: true
[08:24:04 INFO]: -> HolographicDisplays: false
[08:24:04 INFO]: +------------------------------------+
If it helps, /baltop has been growing slower over time as accounts get added. There's probably some silly O(N) or O(N^2) loop in there or something. Maybe it's grabbing the entire database and sorting it in the plugin instead of letting the database sort it.
interesting, do you have discord? if so do you think you could make a ticket?
Hah, is this not a ticket? Yeah, I have discord. I'll file a ticket there, I guess. Eventually. Heading out shortly.
Skimming through the code a bit, in BalTopManager, loadFromDatabase() has the following:
for (String playerName : EconomyPlus.getDBType().getList()) {
[...]
money = CacheManager.getCache(1).get(playerName);
So it seems to me it's doing a cache request for literally every player in the database to get their balance. And since the vast majority of people won't be online, I bet that's not a super warm cache.
Hah, is this not a ticket? Yeah, I have discord. I'll file a ticket there, I guess. Eventually. Heading out shortly.
That's all good it's usually easier for us to track your ticket on discord but this is fine as well it doesn't matter to much.
Do you think you could make a ticket on the discord?
Hey there's been an update. If your able to clone the project and build the latest commit or wait for a release, I can send a compiled version on discord to, I have updated the way balance top works for H2 and MySQL databases, so they get sorted using queries rather than comparing each value. I also updated a few things to try make balance top more efficient. YAML databases will still compare each value. A future update will improve on the already existing "cache" that stores everyone's balances in memory.
Was this ever fixed, @jakepronger? My server actually explodes (Massive lag spike) whenever anyone does /eco and just lets it parse the insane amount of player-names. Bonus lag if you just run /eco followed by a random word.
Sorry for the late response but a performance update will be released in version 5.0
Describe the bug Running baltop is very server-intensive. Several players running it at once tanks the server for quite a while CPU-usage wise.
To Reproduce Run baltop (edit: with a large database, large being 8k+). Better get, get like 8 people to run it at once.
Expected behavior Instant response.
I don't understand why baltop takes so long. An SQL query like "select * from table order by balance desc limit 10" should be literally milliseconds. :/