Multiplayer / Integrated servers have very poor performace and cannot keep up even with one player on a high-end PCs / Servers / Machines
Description
Vanilla server platforms (integrated and external) are very poorly optimized and can barely run smoothly, even on a high-end hardware with higher amounts of memory allocated.
Typical, small multiplayer server drops to critically low TPS and can crash / be forcibly shut down by the watchdog (if enabled) with just a few players normally generating new chunks (in survival gamemode).
A server, using the "Default GUI" is almost impossible to run stable. When launching it via command line and allocating sufficient amount of RAM, the performance is a little bit better (and the server is not running out of memory), but the playing experience is still very rough and there is quite a lot of rubber-banding, freezes, lag spikes, etc.
How to reproduce the issues & Testing methods
Singleplayer (Integrated Server)
Launch the game with plenty of memory allocated (4GB is usually more than enough)
Enter into a world or create a new one
If creating a new world, initially there are extreme framerate drops (probably client-side issue), the integrated server is rubber-banding and skipping ticks
Start exploring the terrain around and perform the usual things (generating / loading new chunks, dropping item entities, etc.) - There will be noticable stuttering, lag and rubber-banding when punching mobs or making redstone circuits, for example
If the player is in creative mode (or spectator mode) then everything becomes much worse
If you are playing in a survival world for long enough (assuming there are animal pens / farms, some mob grinders, chest rooms with item frames and similar) the world will run much slower and this can cause issues with redstone circuits, influence on the gameplay and so on.
Multiplayer (Vanilla platform, without any mods / tweaks / changes)
Start a server on a relatively powerful hardware with sufficient amount of memory allocated (4GB again, would be probably more than enough)
Join the server, along with a few other players (2-4 players at the same time is normal, 5+ will be a bit heavier)
Start playing as usual (exploring around, interacting with entities, mobs, items) - There will be clearly noticable rubber-banding and lag spikes, which usually result in stuttering entities, desyncing issues between the clients and the server and other
If some of the players start to generate new chunks on creative mode, the server will most likely crash.
Testing methods & RAM allocation
Tested and experimented with many combinations of JVM heap sizes (amount of memory allocated), using the default, "recommended" start-up command line:
java -Xms<Initial Memory>M -Xmx<Max Memory>M -jar <Server Jar>.jar nogui
(Xms = Starting Memory / Xmx = Maximum Memory)
Xms1024M / Xmx1024M
Xms2048M / Xmx2048M
Xms3072M / Xmx3072M
Xms4096M / Xms4096M
Xms6144M / Xmx6144M
Xms8192M / Xmx8192M
Xms1024M / Xmx2048M
Xms1024M / Xmx3072M
Xms1024M / Xmx4096M
Xms1024M / Xmx6144M
Xms1024M / Xmx8192M
Players at the same time: 1-3, 3-5, 5-10
Usual activities during the tests:
Exploring the terrain around in survival mode, creative mode (for a while), spectator mode (just for the experiments, not expecting actual results)
Interacting with mobs, entities, armor stands, droppping and picking up item entities
Placing water and lava (creates many block updates)
Small, medium and advanced redstone circuits (light, piston, hopper updates)
Small, medium and large mob farms / grinders
Updating gravity-affected blocks (sand, gravel, concrete powder)
Entering different dimensions and teleporting items, mobs, entities through portals
Transfering small and large amounts of items through hoppers
Loading previously generated and alredy saved chunks
The RAM & CPU usage (especially) was abnormally high for very small and short activities or sometimes none at all. Not only chunk generation is causing the more serious issues (but mainly it is).
Conclusion
The main reason for most of the issues is not exactly the TPS drop / loss / poor server performance, but client-side ticking, updates and synchronization.
Other games (clients) handle the updates, coming from the server in different way.
If the server can't keep up with the consistend update rate / tick rate, then the client should enable some sort of "interpolation" and increase slightly the delay between the changes (updates).
The Minecraft client runs at hardcoded 20 TPS and waits for the next tick from the server. If it is synchronized (matches with the incoming client update / tick) then it runs normally.
But even if the server drops to 19.99 TPS - There is desynchronization once in a while and this can create issues (mainly client-side).
Overall, the server performance should be definetly optimized more and some things can be tweaked.
Related issues: MC-117611, MC-44385, MC-4890, MC-342, MC-54026
Linked issues
is duplicated by 3
Attachments
Comments 57
when in singleplayer, and on server I also experience the dreadful lag even on a i7-7700HQ turbo-clocked
@unknown I see you have 3 machines listed/tested but just to clarify:
What is the OS the servers is running on?
Is your server running on a dedicated machine and client on another?
Is your server running within a virtual machine?
Is your server running any other virtual machines?
@unknown Thanks for pointing this out, I forgot to clarify these particular things.
All machines are running the latest Windows 10 (x64) all the time. However, along with the testing I had several OS re-installs on two of them. (The second one in the "environment" field is my friend's PC, we ran multiple tests not long ago)
My main and "secondary" PCs (the 1st & 3rd) were running on Windows 7 (x64) quite a while ago. I had initially performed the first tests back then when I created this issue.
I've tested multiple operating systems, including Windows 7, Linux Ubuntu (Server & Desktop edittions), Windows 10 (the older versions) and currently the latest versions / updates.
None of the physical machines was / is running Virtual Machine in the background, nor other external softwares / background processes.
The client was running on a different device (laptop) and the connection between the server(s) and the client(s) had no effect in any way while testing.
Additional info:
I, along with friends of mine can confirm the issues, we were experiencing. During the tests there were other, actual players for more realistic and accurate results. (Not idle / AFK clients, just connected from one place)
https://bugs.mojang.com/browse/MC-160373 My bug report contains debug 🙂
Thank you for the report and all the information in this ticket!
However, we are now closing this, as it is too broad and vague to be possible for us to act on. We are continuously working on performance improvements, and if you have information about specific features or scenarios in the game that cause performance degradation, please post new, specific bug reports for those cases. Make sure to include:
Reproduction steps
Screenshots with the debug performance graph open
Profiler data (file written by doing /debug start followed by /debug stop) captured when performance was poor
Debug reports (file written by doing /debug report)
If the problem is not easily reproducible in a freshly created world, it would also be helpful if you provide your world as a shared download.
Again, thank you for all the help in tracking down these issues!
Hi i have same issue. I have big tps loss with 20 and more players.
I think it's because the server does not use all of the server threads. It always performs an operation on one thread and, when the operation is complete, starts another operation on the next thread.
Debug Log
Server version 1.15.2
Hosting server specs:
name: Linux
version: 4.19.0-6-amd64
jvmversion: 1.8.0_222
arch: amd64
maxmem: 14316732416
cpu: 16
runtime: 36848742
flags: -Xms1G -Xmx15G
@unknown your attached debug report is useless in this case, as it's from a modded server (paper). We only support unmodified vanilla Minecraft.
Does MC-117611 describe your issue?