RAM usage too high with SpongeForge

Hello !

So, I’m managing a 1.12.2 server with forge & sponge. We’ve been experiencing server lags for a while so I tried to dig to find the cause.

I’ve been using VisualVM to monitor JVM and I found a weird pattern with the ram usage

Everytime the GC is triggered, the server freezes, which is normal but why is there so much ram used ?

I’ve tried to remove plugins and mods one by one, starting with sponge plugins. Nothing changed until I removed sponge itself

Okay so, Sponge seems to be a problem. I then tried to find why sponge is using so much ram, without finding the exact source but with sponge and a totally new map, no problem

So, why is sponge using so much ram with my server map (of course, erasing the map is not an option) ? I performed a heap dump to see object in ram:

So, 22% of the ram is used by this HashMap, let’s see what’s in there:

Also, what are all these PlayerTracker classes ?

Now, I really have no idea what to do to fix the ram usage. We have a lot of plugins, some we’ve written so we can’t juste throw sponge away, we need it

If anyone can help me… Thanks in advance !

We’re missing context here. You say that on a fresh new map Sponge is fine - but what is different about your current map? What about the number of players? Human NPCs? What about GC flags - Aikar has written about his experiences and suggested flags to use.

I understand the pauses are troubling but in order to understand why we do need to know a bit more of the context.

Thanks for your answer !

We’re a roleplaying community in a realistic medieval context so we don’t have a lot of complex mods.

Here is the mods list:

The heapdump I did was with no players connected.

JVM arguments:

We’ve got NPCs but I already tried to remove CustomNPCs without noticing improvements.

Concerning the map, I don’t know what’s wrong with it. It is a medium sized medieval city, nothing fancy, no redstone