ShopChest icon indicating copy to clipboard operation
ShopChest copied to clipboard

Doesn't scale with many shops

Open haugsvar opened this issue 7 years ago • 5 comments

As much as I like this plugin, having lots of shops causes excessive use of simultanious java threads both in paperspigot and spigot. These threads causes some kind of starvation, high load average, and in the end starvation on the java process causing lag and users to disconnect.

Neither paperspigot timins/tps nor the operating systems ps/top caught any cpu intensive tasks, though load average spikes extremely high at most peaking at 1900 load average, but every thing except this worlds java process was still responsive. Counting ps output of running threads regularely counts > 1000 with > 700 shops.

Using jvisualvm, it becomes clear that ShopChest is the one creating the threads and removing the plugin gets the server back to normal without the thread numbers going wild.

I guess the plugin is working as intended with seperate threads doing it's work to reduce in-game lag but it doesn't scale to a large number of shops.

haugsvar avatar May 14 '18 18:05 haugsvar

Been having increasing lag on the server, and recently the plugin crashed the server completely and it could not restart until I removed the plugin. Once I removed it, it seems as if the lag was gone until I re-added it (It is still installed at the moment). It would be nice to see a fix, since this is a good plugin.

blazex224 avatar Jul 28 '18 18:07 blazex224

@EpicEricEE please, this is an important issue for large servers.

sgdc3 avatar Jul 28 '18 19:07 sgdc3

I am aware of that, but I'm not sure what to do about it.

EpicEricEE avatar Jul 28 '18 19:07 EpicEricEE

if the problem is threads you have to check again how you are using async tasks, probably your design is wrong.

sgdc3 avatar Jul 28 '18 23:07 sgdc3

Async threads are only created on database interactions (which are called on every transaction for the economy log), so if that's the cause of the issue, the player count should have a higher impact than the shop count. I have also looked at jvisualvm, but have not noticed a high amount of running threads (only finished ones). The shop updater itself is one thread (as of 3b9d26c (changed now with 5c2c316), not sure about v1.12.3), but as I'm not able to test on a server with a high amount of players and shops, I can't tell how well it performs under these circumstances. However, one thing I have noticed (with 50 shops and only me as a player), is the (re-)loading time, which is too high. I can only imagine how long a server with several hundred shops would take to start or reload.

If you have the resources to test the latest changes with a larger player base, you can try a build from here (requires a language file reset).

EpicEricEE avatar Jul 29 '18 20:07 EpicEricEE