BattlePlugins / BattleArena

A complete match and event framework for creating arenas and minigames in Minecraft. Supports creating modes through config files, or fully custom modes through plugins.
https://docs.battleplugins.org/shelves/battlearena
GNU General Public License v3.0
21 stars 23 forks source link

Matches Causing Server-Wide Lag [Performance Issue] #117

Closed Webman97 closed 4 years ago

Webman97 commented 4 years ago

My entire multi-world server lags when this plugin is used under the following parameters:

  1. Joining a match after server restart (longest lag spike)
  2. Switching from Joining to Waitroom
  3. Switching from Waitroom to Game
  4. Switching from Game to Leaving

Are there performance tweaks I can make to have the above disappear completely? I'd like my players to experience zero lag between games, but I dont want to set up another server dedicated to this plugin.

======================================= If the above is not possible, another solution may be to add an enhancement - maybe some form of session buffering? The best example of this that's actually in practice is WorldEdit vs AsyncWorldEdit - WorldEdit provides the functionality while AsyncWorldEdit prevents the entire server from crashing/lagging/etc.

In the context of this plugin, that functionality may look something like this: A player joins a game lobby and gets the following message: "Generating Session". Instead of the whole server lagging, the job is buffered and sends the message "Session Generated" when completed.

Thoughts?

Redned235 commented 4 years ago

My entire multi-world server lags when this plugin is used under the following parameters:

  1. Joining a match after server restart (longest lag spike)
  2. Switching from Joining to Waitroom
  3. Switching from Waitroom to Game
  4. Switching from Game to Leaving

Are there performance tweaks I can make to have the above disappear completely? I'd like my players to experience zero lag between games, but I dont want to set up another server dedicated to this plugin.

======================================= If the above is not possible, another solution may be to add an enhancement - maybe some form of session buffering? The best example of this that's actually in practice is WorldEdit vs AsyncWorldEdit - WorldEdit provides the functionality while AsyncWorldEdit prevents the entire server from crashing/lagging/etc.

In the context of this plugin, that functionality may look something like this: A player joins a game lobby and gets the following message: "Generating Session". Instead of the whole server lagging, the job is buffered and sends the message "Session Generated" when completed.

Thoughts?

This has to do with the current scoreboard code, which unfortunately is not the best. I've tried many different methods to optimize it, but ultimately as far as I can tell, it'll require a rewrite of the whole system, which we are planning on doing in the rewrite of the plugin anyway. For the time being, you can disable the scoreboard to get rid of these performance issues, and if it's important that you have one, you can use any scoreboard plugin with PlaceholderAPI support as an alternative as BattleArena has support for PlaceholderAPI.

Webman97 commented 4 years ago

This has to do with the current scoreboard code, which unfortunately is not the best. I've tried many different methods to optimize it, but ultimately as far as I can tell, it'll require a rewrite of the whole system, which we are planning on doing in the rewrite of the plugin anyway. For the time being, you can disable the scoreboard to get rid of these performance issues, and if it's important that you have one, you can use any scoreboard plugin with PlaceholderAPI support as an alternative as BattleArena has support for PlaceholderAPI.

That's fantastic news! Thank you!

I'll confirm disabling the scoreboard works before closing this issue out.

Webman97 commented 4 years ago

@RednedEpic This resolved the issue - thank you!!