Constant lag on Forge server

I am running my Forge server on a Gen8 server with 132GB ram (the minecraft server itself uses 100GB ram) and two Intel Xeon XPU E5-2640 0 @ 2.50GHz. both cpu’s together make 24 threads total and 12 cores. The server uses most of these resources, but I made sure to leave some for the Operating system.
The server TPS is almost always at 20, but it drops to 19.990. How am I still seeing around 400ticks of server “overload”? my ping is perfect too and I only play with 4 people total… the mods are not that heavy

are you reading logs?

Yes, but most of the logs don’t help. Console just says “Can’t keep up! Is the server overloaded? Running 5860ms or 117 ticks behind” a bunch of times

Well troubleshoot backwards then.

  • Minecraft console / Logs
  • Linux Distro
  • Actual hardware / Hypervisor?

Are you running this on bare metal or do you have a hypervisor? Regardless go backwards seeing as the console and logs of the Minecraft server are not showing anything out of line then look at what MineOS and Java are doing in Linux itself.

Is there high Memory or CPU time? What is the WebUI saying? 400 ticks behind is going to be extremely slow but if there is nothing in the logs that is erroring then that would suggest that the issue is outside of Minecraft for some reason.

another thing to consider is spin up a totally vanilla server on your hardware and see if it produces the same outcome with lagging behind, this would be a clear cut way to know that there is something more deep seated going on.

^ this is the key. 100GB for a 4 person minecraft server is obscenely over the top, but if it can be thought that Minecraft can use it, then that instance of minecraft can potentially be over-packed with mods.

We can’t do much to validate that, but trying it without mods to see if it runs well does a lot to point us in the direction of the fix. Considering your hardware, it seems far more likely a software issue of Forge, but there’s far too little info here to determine concretely.

I don’t know about your version of Forge, but Minecraft from when I’ve hosted it basically never used anywhere near this insane of resources, and neither could it make good use of 24 threads.


As an aside, consider giving LESS resources to Minecraft while troubleshooting to see if the performance stays the same, because it is critical to know whether or not it is used, in any way.

If it is NOT used, what you’re doing is forcing Minecraft to cache everything, rather than commit-to-disk-and-unload-from-memory. Why is that important? It’s the equivalent of if I asked you to build a model toy and I gave you a workbench that is 3ft x 5ft, or If I gave you the same toy and a workbench 300ft x 500ft…

The analogy isn’t perfect, but it is largely relevant: when Java does heap cleanups, having to review 300x500 takes longer than 3x5, and java heap cleanups are not meant to be interrupted. That means that you’re deferring work (e.g., unloading a zone) in Minecraft that hasnt potentially been visited (ingame) for a long time, but you’re unloading all that work at the exact same time.

The alternative is the clean-up-as-you-go approach for a modestly sized heap. So it can take 1 or 2 seconds to clean up the heap (a performance hiccup that can go unnoticed), instead of maybe 10 seconds (or longer–which would definitely be noticed); this lines up with “overload” messages and why you still have a perfectly good latency, all the time.


I tried to keep it as analogy-simple as possible, but the main takeaway is that wanting to provide infinite memory isn’t bad, but Java’s design of memory (called tenured and untenured memory) means that heap cleanups of enormous capacities can take an amount of time–and real time performance–that a user in game would notice.

I am of the same thinking and was going to mention it too that sometimes to much memory is counter intuitive.

I agree and that slim the footprint down to like 4 or 8gb and less cores threads. An Minecraft server will not need that much resources. That would be a big stack to manage maybe its like GC related issue from big memory pool or something.

IDK hard to say really but when it doubt start off small and then scale bigger because you can pinpoint easier on a smaller scale. What this means is make it barebones server with limited resource and work up from that once you know what is happening.

A stock mc server could run on like 2gb ram and 1core 1 thread at minimum no need to go that low but go the other end from extreme surplus lol.

it also does not make sense that the server is reporting as behind in ticks in the console but no errors as it will generally log reasons why its behind like error etc, this is a dead give away that its not the actual game loop at runtime but something before it like at the provisioning stage or the jvm itself or something else within the OS causing an issue.

Ticks behind spam just means slow game loop but you are essentially having that with no other error which is a misnomer in that sense.

That can be the issue, How many threads and Ram do you recommend then? My friends really like to explore and build way to many and way to big farms, what is the sweat spot in between “too much ram”, and not enough ram?

What I forgot to mention is that lag only occurs when loading in chunks, or other heavy tasks. There is no lag when everyone does nothing or if you play alone on the server. I also have a few graphes of the cpu and ram usage when the server is online (and has lag).



well that ram issue is using like nearly the whole pool of ram 112gb, its definitely a GC issue.

One way to test your ram requirments is monitor the ram usage when no one is on the server that gives you the stock baseline ram needed just for idle. This will be like 1gb or 2 gb. You then log on to the server by yourself and then look at the ram usage.

So lets say for example the server needs 2 gb at idle with no players. You log on and it goes to 2.5gb so you know from that, that you will require 500mb of ram per player. You factor that by 4 because 4 players so you need 4gb total ram to run the server bump that up 1 or 2 more GB for head room.

Edit: Actually that looks to be a monitor from your hypervisor so that is normal that its at cap, you need to look at the ram usage from MineOS Webui or the linux distro etc.

I gave the server 10GB of ram, and 6 threads. 3 people started loading as much chunks as possible, and the lag is noticeably low. The cpu usage is 100%, and the ram is fully used, But it works (kind of) The lag used to be 200+

image

The lag is still kind of high for my liking, but that means I will just have to play around with cpu and ram power for a bit?

89 ticks behind that is nearly 5 seconds a full game loop should be 1 second or 20 ticks when there is no lag.

  • what mods are you using?
  • Are you using any JVM arguments?

Another option is to pre gen chunks as you mention the issue is happening when chunk loading. Allthough i think with only 4 people on the server and you mention light mods then it should not really be an issues if its more recent version of Minecraft.

Although forget all that ^ something is not lining up because you should not see the cant keep up error at all on a server that is performing as it should.

image
These are the mods, and these are the Java settings
image

What is 50000? this may or may not be the issue or at least is not helping? but you should at least make it correct syntax.

You should be clear cut on this like example for 4gb put 4G or 4096m etc. Tailor to suit 1024mb in 1 gb so for 10 gb it would be 10240m or just 10G etc

If i think i am understanding correctly then you were trying to say 50gb? it would also seem that you have slimmed your hypervisors pool to 10gb now if i am reading the forum thread properly.
This is a misnomer because there will only be 10gb resources available to the Linux host onward and your launch command for the game server wants 40k minimum looking at that image which is not possible now.

Also that modlist is tiny not the issue.

Put your hypervisor ram for that instance back to 100+gb or what ever it was this is system ram for the distro so this should not be an issue, and then tune that server command to use a ram amount but go with like 8 gb and then test see what happens while testing.

just put xms and xmx to the same values too There is not much reason to min max just give all the memory at once.

I don’t know why but 50000 = 10gb. I don’t get it, but if I put that value, the server uses 10 gigabytes of ram.

I think also you need to monitor at the right place. These images look like some sort of hypervisor which is the wrong place to monitor for issues, it gives you an over look of the bare server and what its doing but its not granular past that.

1 Like

Do you have any updates on your fix? I have the same issue… Forge server, running on hypervisor, plenty of Ram and CPU (with little used) but always behind!