BentoBoxWorld / BentoBox

Expandable Minecraft server plugin for island-type games like SkyBlock or AcidIsland.
https://bentobox.world
Eclipse Public License 2.0
333 stars 137 forks source link

Optimize major things #2430

Closed rudde0 closed 2 months ago

rudde0 commented 2 months ago

Is your feature request related to a problem?

I started to develop my server under BentoBox's API. And I realised that BentoBox would be heavy for the server over few years of server run if there are lots of unique islands.

The issue is, server will start work slower over the time since islands are always kept by HashMaps. So addons and BentoBox should get rid of unnecessary holdings to minimize the usage of resources.

Describe the solution you'd like.

BentoBox needs to let it go if data is unneeded by any process.

For example there is IslandsCache#islandsById hashmap which is holding the keys all the time. This hashmap keeping the keys even the its island isn't used by any player. Holding value as null, marks the island isn't loaded for sure but for the Java? It will keep iterate and lose time when searching needed data.

So some caches like IslandsCache#islandsById should get cleaned if value needs to be null.

Describe alternatives you've considered.

Also some other addons just do loadObjects when their manager is constructed like Limits. Why it is done even nobody is in island yet?

Overall, project BentoBox is great and I love to work with BentoBox's API but it needs to be getting sharpened for the better performance.

Agreements

Other

Thanks for consider my suggestion.

tastybento commented 2 months ago

Thanks for the suggestion, but this sounds theoretical. If you have some problem (maybe in a few years of running a successful server) then we can work to optimize your successful server!

We recently shifted to a cache-optimization of only loading islands when they are required. The minimum information is loaded for islands (location and size, and uniqueID). When locations are checked, there are not iterative searches done -hashmaps use a hash lookup, so they are fast and efficient.

rudde0 commented 2 months ago

okay then, thanks for the explanation

you can close the issue if you want