Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lag Caused by `PortalPlacer.onChunkLoad() #439

Open
DarkChromaMC opened this issue Aug 7, 2024 · 1 comment
Open

Lag Caused by `PortalPlacer.onChunkLoad() #439

DarkChromaMC opened this issue Aug 7, 2024 · 1 comment

Comments

@DarkChromaMC
Copy link

The AdvancedPortals plugin is causing significant server lag due to the com.sekwah.advancedportals.bukkit.listeners.PortalPlacer.onChunkLoad() method being called every time a chunk loads. This issue is particularly noticeable when new chunks are being generated. In our server setup, the portal block is only used once for creating portals at Spawn and is never used again, making the frequent calls to this method unnecessary and performance-heavy.

Steps to Reproduce:

  1. Install the AdvancedPortals plugin on a Minecraft server.
  2. Ensure the server has areas where new chunks are frequently generated (e.g., exploring new areas).
  3. Monitor server performance and observe the high CPU usage and lag spikes correlated with chunk loads.

Expected Behavior:
The PortalPlacer.onChunkLoad() method should not cause significant lag, especially when the portal block is infrequently used.

Observed Behavior:
Low TPS is observed when chunks are loaded, due to the PortalPlacer.onChunkLoad() method being called excessively.

Impact:
This issue severely impacts server performance, making it difficult to provide a smooth gameplay experience, especially in areas with high rates of chunk generation like players flying with an elytra.

Environment:

  • Minecraft Version: 1.21
  • AdvancedPortals Version: Latest 1.0.0

Proposed Solutions:

  1. Introduce a setting in the plugin's configuration file to disable the onChunkLoad listener for servers that do not need it.
  2. Optimize the onChunkLoad method to reduce its performance impact. This could include caching results or reducing the frequency of operations performed during chunk load events.
  3. Implement a conditional check to ensure the onChunkLoad method only processes chunks if they contain relevant portal blocks, avoiding unnecessary processing for chunks without portals.

Additional Context:
Our server primarily uses portal blocks at Spawn for initial setup, and they are rarely used elsewhere. Therefore, the frequent calls to onChunkLoad are unnecessary in our context and degrade server performance.

Attachments:
https://spark.lucko.me/6rbL5fAZds?hl=752

Thank you for your attention to this issue. Optimizing or providing a way to disable this feature would greatly enhance server performance and player experience.

@sekwah41
Copy link
Owner

sekwah41 commented Aug 7, 2024

I have plans to optimise it as paper has a value you can pass to it but spigots implementation is super inefficient. Though adding a value to toggle it would be good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants