ObelusPA / CreativeParkour

Bukkit parkour plugin that allows all the players to play and show their skills in fun parkour maps they build or download!
https://creativeparkour.net
GNU General Public License v3.0
3 stars 9 forks source link

Lag Spikes #1

Open Shivelight opened 7 years ago

Shivelight commented 7 years ago

First, let me thank you for this amazing plugin!

I got problem with lag spikes (about 1 sec, tps drop to 2-5) on my server, caused by PlayerMoveEvent listener. I'm not sure which part of the code tho. Not only PlayerMoveEvent, InventoryClickEvent might be the problem too.

Take a look at my timings report: https://timings.aikar.co/?id=d65d5060ba51477fb9732b71844f3003

Average player is about 20-30 at a time.

ObelusPA commented 7 years ago

Thanks for these timings, I will try to improve performance using them. 🙂

Shivelight commented 7 years ago

Little suggestion that can (maybe) eliminate the lag, is to reduce the usage of PlayerMoveEvent. Maybe what I'm going to suggest need a major rewrite to implement, but I'll give a shot :3

Use stone pressure plate to trigger something, PlayerInteractEvent is not that extensive. Can be used as checkpoint, teleport, effect, start, end, give, and optional checkpoint (maybe using wooden pressure plate, so player not confused with main checkpoint). (We still need to use a sign to define something, but later replaced with respective pressure plate).

We can choose what we preffer to use, either pressure plate or fancy move event :)

ObelusPA commented 7 years ago

Nice idea, but the problem is that only one player at a time can trigger pressure plates, so if there are several players in the same map, players may not trigger them because there is someone else standing on the pressure plate (especially on your server when there are many players playing). I am first trying to improve PlayerMoveEvent performance, but I keep your idea in mind if there is still lag. And I can add pressure plates as an option anyway, it may be useful. 🙂

Shivelight commented 7 years ago

I just did a test. If you cancel the event, the pressure plate will not get clicked, and keep spamming/firing the event if you stand on it.

Here is the test with 2 player on the same pressure plate - https://pastebin.com/BX34pR8Y

ObelusPA commented 7 years ago

Ok, I did not cancel the events when I tested it. Thanks for the tip! So I will probably add pressure plates as an option.

ObelusPA commented 7 years ago

I added pressure plates and improved performance in the new update. You can also lower the "memory dump interval" value in configuration.yml, it should improve performance too. Tell me if it is better on your server now. 🙂

Shivelight commented 7 years ago

The performance is actually improved but some lag spike is still there, I can't provide timings as I'm using MassiveLag to debug which code causing the lag. Here you can see the log:

onInventoryClick (When you click on map from /cp play. Always happen) https://hastebin.com/udebojebom.md

onPlayerInteract https://hastebin.com/isesocazob.md

I hope that provide you useful information ❤️

ObelusPA commented 7 years ago

It seems that loading leaderboards takes a lot of time, I have to improve this. Creating different files for ghost data may be a solution, I will probably do it.

Shivelight commented 7 years ago

Any chance for mysql? I also need it for my web based players statistic.

ObelusPA commented 7 years ago

I really want to add MySQL support, but it will take some time, not in the next update I think. 🙂

Shivelight commented 7 years ago

Can you add option to disable scoreboard for now?

ObelusPA commented 7 years ago

Yes, but it will also disable ghosts, is it ok?

Shivelight commented 7 years ago

Not a problem 👍

ObelusPA commented 7 years ago

I just added the "disable leaderboards" option in the last update. I will improve the file system as I mentioned before, but it will probably take some time.

Shivelight commented 7 years ago

No lag so far, thank you for your hardwork ❤️