mojira.dev

Tom Carchrae

Assigned

No issues.

Reported

No issues.

Comments

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

 

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]