Lag spike when using towny /town command?
Joannou1 opened this issue ยท 11 comments
Gringotts (2.4/2.5 Github @ Jenkins) & Towny (0.89.2.7/0.89.2.14) & Vault 1.5.3-b37
I get about quarter second lag spikes when the town command is executed.
Server running Spigot 1.8.3 via BuildTools.
CPU / Mem / TPS all fine.
Other economy plugins such as Fe and iConomy do not do this.
Tried using Gringotts with Flatfile & SQL.
Tried setting towny async from true to false.
I don't know what to do!
The spikes are horrible.
It is worth noting that the spikes occur even if there are no vaults owned by the player or for the town.
But yet commands like /money do not cause issues.
Not very useful, but I tried spamming /t and doing a timings...
http://timings.aikar.co/?url=11226664
Did some more testing..
Only plugins installed:
-Towny, Gringotts
No lag.
Added Vault, suddenly lag.
Using vault 1.5.3-b37 (latest)
Adding every other plugin minus vault results in no lag, but everything requires vault, so there's not much I can do about that.
Also, there are lag spikes when a player dies, narrowed down to the same cause.
Added Fe in conjunction with Gringotts, lag disappears, but towny uses Fe instead of gringotts which wouldn't work well!
Thanks
Thanks for looking into this. Unfortunately so far you're the first I know of experiencing this specific problem, so I can't really help. :(
Are you using the default Towny and Gringotts configs aside of the async setting?
Are you testing with an empty world or one with lots of vaults ot town vaults?
I was able to reproduce this with the latest spigot build (1.8.6) and only Towny, Gringotts and Vault, latest version of each plugin from bukkitdev, I also tried to compile latest Towny & Gringotts, still had the problem. I haven't modified any of the configs, and I deleted Towny's & Gringott's config before trying with the new build. Heres a video of the problem https://www.youtube.com/watch?v=rG6UvxK_pXA&feature=youtu.be
Thanks in advance, your plugin is amazing ^_^
Thanks for the illustration. Just for clarification:
- Do you have this problem in a virgin world, or only a more highly developed one?
- If developed: How many town vaults are in your db?
- Do you have any problem when using the /money command?
I'm working together with Joannou on his server, and he's asleep at the moment, so I will answer for both :P
Joan's server:
- The server is in development at the moment, so it's not really developed, however we use TerrainControl & have generated a lot of chunks if it makes a difference :)
- 1-3 town vaults
- Nope, it works perfectly :)
Mine:
- Was just generated.
- 1 chest
- Works perfectly :)
Thanks! I think I get the problem now. Apparently "getOfflinePlayer" now attempts to resolve player names over the internet. Ugh. And Gringotts tries to resolve the account for the town via an offline player. Because it is not a UUID, it will always do a blocking web request to lookup the UUID, which will of course fail. I'll see if this can be easily fixed.
I pushed an (untested) quick fix, see if that works for you, please. Otherwise I might have to see if I can spend more effort on this ;)
I think that did the trick! :)
Popped it in there and did /t and no freezes!
Apparently it takes about half a millisecond now.. which is quite the improvement over the ~500ms web requests lol.
Thanks for fixing this!
If there are any more odd spikes/things I'll be sure to try to narrow it down again to make it a bit easier to pinpoint.
That should be the only occurence of this particular problem. Let me know if everything works as expected otherwise over the next days, and I'll publish an update.
yeah, so far it seems to be an issue with just those 3 plugins, exclusive towards gringotts.
If you need any more information or help leme know.
No hurry or anything, but the timing on this is a bit odd.. (gringotts is the only really good item based economy plugin out there and we really wanted to use it for our new relaunch!)
I took a load/usage snapshot while rapidly spamming /t and got some possibly useful information.
It seems the highest percentage of stuff is in:
org.gestern.gringotts.api.impl.VaultConnector.getBalance() | 20.64%
org.gestern.gringotts.api.impl.VaultConnector.hasAccount() | 19.57%
It seems if you expand those two even more, it boils down to more sleeping and getting offline player requests or something for org.bukkit.Bukkit.getOfflinePlayer() & com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService.makeRequest()
edit
Yup! I just took timings on the getAccountHolder bit.. took 140ms.. There's another one somewhere, I'll figure out where.