It seems when Minecraft 1.14 is idle, it still continues to consume CPU at a significantly higher rate than its predecessors like Minecraft 1.13.2
I've compared the 2 side by side from VisualVM on both Linux and Windows, but I cannot find the cause when I run a snapshot from CPU Sampler. Both results are same, but the CPU consumption is too high on 1.14.
I have included screenshots from VisualVM running both Minecraft 1.13.2 and Minecraft 1.14
1.13.2 - Fresh start, No players, Monsters on, Animals on. 1GB RAM Allocated
[media]
1.14: Fresh start, No players, Monsters on, Animals on. 1GB RAM Allocated
[media]
Results did not change when I turned off Animals and Monsters.
Additional notes:
On Windows, the problem is slightly intermittent... sometimes it might run smoothly and then its almost like something triggers it to go out of idle mode and start munching CPU.
On Linux the problem occurs 100% of the time.
A second issue (which could be related) is that Minecraft is consuming up the server thread by 100% nearly all the time. Players join and stay in a single area, but seems like the Server Thread is still doing something way abnormally high. (Appears to be working with chunks, even though chunks are loaded, perhaps a bug in chunk loading / looping?)
As a result, the server console repeatedly reports falling behind in ticks by 80ms to 2000ms.
NOTE: I have found that the second issue is a known duplicate: MC-138550
So this bug will now only focus on the first issue, which is high IDLE cpu usage. Minecraft server instance uses a considerable amount of CPU with no players in server. It is also a significant waste of earth resources considering how many instances of Minecraft 1.14 is running around the world.
Linked issues
is duplicated by 6
relates to 3
Attachments
Comments 66
I'm also seeing this issue with 1.14. I'm seeing the issue on a Linode instance running Debian 9 with 1 CPU and 2 GB RAM. I don't have servers metrics as detailed as in the description of this post, but I'm also seeing 100% CPU utilization when no players are on the server. CPU utilization was about 5% when running 1.13.1.
Confirmed on my home server (MC 1.14 and 1.13.2 running via mineos in a jail under FreeNAS). Idle difference is about 1% on 1.13.2 vs about 14% on 1.14. It's hard to capture in the CPU data, but visually at least, a single chunk /fill destroy command with about 20 blocks of height (16x16 chunk 20 blocks high, crossing subchunks 2 blocks above, 2 below; ~ 46 ~ to ~15 65 ~15) definitely appears to peg the 1.14 server much harder than the 1.13.2 server ever did. It's VERY noticeable. I've added an image of my results on my (antique?) Q6600 FreeNAS server box. I will note that 80%ish CPU time use with Java is effectively CPU pegged because of FreeNAS doing other normal things on the server.
I can confirm this bug on a Debian 9 machine.
On 24.4 at 4:00 the server was automatically upgraded to the latest version and since then, the idle CPU load increased.
[media]In case it isn't clear: This ticket was closed as fixed. For any performance issues that are still in the game, please create a new ticket and include as much information as possible.
thank you @Michiel - that looks like a very useful workaround. like you, many hours to get things working right here too. dadops. i found a similar script here that uses netcat instead of knockd. although they kill the process instead of pausing it (probably good if you want the ram back), but i know i'd get guff from my users if it took 30 seconds to restart, so `kill -CONT` sounds much better, but i guess it needs some testing to see if any plugins/etc will complain.
consider adding your script to https://minecraft.gamepedia.com/Tutorials/Server_startup_script if you don't add it, i might do so. i use something like their systemd script, which is great when you have more than one server running.
violine1101, while some performance issues may have been implemented, what is a "normal" CPU load for a minecraft server? i don't see this described anywhere, so is what we are seeing is now the expected performance? maybe that just is-how-it-is! it would be nice to have some reassurance that there is a real need for this CPU load rather than being a regression, which it seems many people suspect (and i trust the papermc folks have looked hard at this) https://github.com/PaperMC/Paper/issues/2336
i see ~20-25% cpu with no users. running 3 instances of papermc, ubuntu 18.04, i3-5010U (2.10GHz, 2 core, 4 thread), 16gb ram. some have no plugins, some have several, CPU no different.
is running papermc the issue? would running vanilla mean less cpu? (somehow i doubt it)
i agree with the comments on electricity use. not a scratch on bitcoin mining perhaps, but wasted cpu cycles are carbon pollution and that matters on scale. concerned folks using workarounds won't make much of a scratch, but we do it on principle. would be better to have a fix in the code.
as mentioned above, may be parkNanos as @momcilo mentioned. the article he linked in particular (https://hazelcast.com/blog/locksupport-parknanos-under-the-hood-and-the-curious-case-of-parking/) and the fact that parkNanos is OS dependent, so maybe there are no performance regressions in windows or whatever is used in the developer QA tests. update: i spent quite a bit of time looking here, and i'm not clear this is helpful. an idle server uses ~20% cpu, and pretty much all in "Server thread" (`jstack $PID | grep cpu=`) eg,
"Server thread" #20 prio=5 os_prio=0 cpu=388166.97ms elapsed=1866.16s tid=0x00007f4860f5b800 nid=0x7392 runnable [0x00007f47f57e8000]
here is my take on minecraft-sleep.sh: https://gist.github.com/carchrae/3dc0da023c8e9bb36441dcd439950870
upside of my script; no root access/knockd required and can be run as regular/restricted user. this script also resumes the server every so often. papermc will restart if it hangs up.
the server log is pull of papermc warning about not being able to keep up (and giving stack traces of where it stops). one thing that is clear is there is a lot of state management going on even with no users. it isn't just parkNanos or something easy like that. from fish flapping to pathfinding, there is a lot running on the server even without users.
overall, i think it would be much cleaner to shut the minecraft server off on inactivity and let the first person to connect endure the 30-60s startup time. anyway, this is faster to connect and nothing bad has happened, yet...
> Can't keep up! Is the server overloaded? Running 7702ms or 154 ticks behind
Again: There is a LOT happening in a Minecraft world that is completely independent of players being online. I don't think anyone here has so far reported very high CPU usage with an actually new world with no machines, mob collections, etc. in it. Of course those things require CPU, because they do work!
Also, saying "25%" doesn't help much. Please specify if it's 25% of one core or of all summed up and what the maximum speed of the CPU is. And again, don't complain about lag if there are things in your world that cause lag!
This report was about constantly near 100% usage of one CPU core at all times, even in completely empty worlds. Play 1.14.0 if you want to see an example.
Paper is of course not valid on the bug tracker, because it's not made by Mojang. And yes, mod loaders often make performance quite a bit worse and mods especially.
Same issue on both Prerelease 5 and Release 1.14. Makes the server agonizingly unplayable. Kicks every few minutes, projectiles/actions in slow motion etc.