bsalha1 / Printer

This is a plugin for Minecraft that aids in building, as it gives the player creative mode and charges them for each block they place. All exploits are patched as well.
GNU General Public License v3.0
6 stars 5 forks source link

Lag #4

Closed Kahouk closed 3 years ago

Kahouk commented 3 years ago

Each time a big amount of blocks is placed server tps drops by a lot like from 20 to 18 or even lower. When doing timings reports its always the printer block place listener event. Any way to fix that? Btw we use stellar spigot with 20gb ram and a good cpu so It's for sure not the hardware

Kahouk commented 3 years ago

If needed ill send you a timings report

bsalha1 commented 3 years ago

I have seen this issue - for some reason, calls to the Vault API to withdraw balance or get balance are extremely laggy. I'm going to figure out how to fix this when I have time - hopefully this weekend some time.

Kahouk commented 3 years ago

I have talked to our dev about it well either way what came out from us it's probably vault the way it get's the balance. I don't know maybe make it not get it each time it places a block but each like 60 seconds? Maybe you already know more than us either way, if possible please fix it as fast as possible since we can't find any other plugin except that :/. Thanks a lot for the quick reply and your efforts!

bsalha1 commented 3 years ago

It's actually the withdrawal, because for most economies, every withdrawal requires a write to a file. I just came up with an optimal solution for it, and it will not lag at all. I'll release it soon, I just have to help someone with their shop hook.

Kahouk commented 3 years ago

Not sure if the new version is supposed to already be fixed or not but the tps does still drop quite a lot while printing even tho the timings reports are clean now. The slowly taking away of money does allow for people to print more than it costs tho since the balance just goes to 0 slowly and you can still print since the money is taken delayed. If needed i can send a video showing the server tps while Printing.

bsalha1 commented 3 years ago

The money taking actually shouldn't be delayed. Could you send me a spark report using this plugin https://www.spigotmc.org/resources/spark.57242/. You do /spark sampler when its lagging and then still while lagging do /spark sampler --stop. That will help me figure it out.

Kahouk commented 3 years ago

Sorry for the late respond i was on a trip. Yea i'll do that when im on the server again should be done by tonight

Kahouk commented 3 years ago

alright here you go https://spark.lucko.me/#27Z2hG19pN

and also the money is still being taked offset over time which even creates a negative balance for opped players

bsalha1 commented 3 years ago

Alright, I can fix the money delay, now it looks like the major lag-causer is getting the price of items with shopguiplus. I will try to apply the same sort of solution I partially used for getting balances and withdrawing. I'll work on that this weekend.

Kahouk commented 3 years ago

Thanks. Now that you mentioned it's mostly the hook to shopgui+ while getting the prices, would the lag then stop if i disable the hook and instead use the shop prices list? I really hope it's possible to make the plugin more stable when coming to lag since it has pretty much everything else like the hook to factions and a lot of options/ dupe fixes.

bsalha1 commented 3 years ago

Yes, disabling the hook will stop the lag, according to the spark report. I'm going to try and fix everything today.

bsalha1 commented 3 years ago

Before I release this, could you run this and if you still have lag, send me another spark report so I can make sure it's printer that's actually lagging? http://www.mediafire.com/file/lfpmzmhh4jg0t4s/Printer-LATEST.jar/file

Kahouk commented 3 years ago

Ayt lemme test it

Kahouk commented 3 years ago

Still lags while using printer, but less than before. Also what i realized is when you exit printer it wont disable your fly which results in getting kicked for fly if you dont go down yourself

heres the report https://spark.lucko.me/#O7yd6DwNzR

bsalha1 commented 3 years ago

Oh okay, I think I can fix that. As far as the lag is concerned, I can see Printer isn't really lagging very much, but it does look like now the biggest factor is changing the scoreboard and some little issue with how I check if a block is colored. Only way I can fix that source of lag is by sending scoreboard packets every x seconds instead of making it instant, and figuring out why checking if a colored block is lagging. Printer really does not seem to be causing that much lag by this spark report. What TPS are you experiencing while printing?

Kahouk commented 3 years ago

The tps does stay at 20 sometimes but other times it get's down to 18. Usually while 2 people at printing which we tested today it was at around 19,5. As soon as printing stops it jumps back 20. I know 19,5 doesn't seem too bad but for a faction server if there are 4-5 people using printer for example while a raid and then usual player activity + cannoning comes into place we really want to make the lag as less as possible. Over all there were big improvements tho between this version today and older ones. Other than that, any idea why trap doors aren't printable? Thanks a lot for the support, one of the quickest support I got until now regarding a plugin. 👍

bsalha1 commented 3 years ago

No problem, I'm going to try and make the scoreboard less laggy and the other thing with colored blocks. I will see about trap doors.

Kahouk commented 3 years ago

Trap doors were server sided we found the issue, it was because in shopgui+ the damage of the item was set to 1 so each time one tried printing a normal trap door it didnt recognize it as the same in shop and would just say no price set.

Other than this, feel free to close the issue report since it's pretty much solved. Thanks a lot :D

bsalha1 commented 3 years ago

No problem.