Home > OS >  Minecraft server use all CPU
Minecraft server use all CPU

Time:10-12

I want to create a private minecraft server on my raspberry pi 4-b with 8 GB of RAM So i have install Ubuntu server 64 bit and openJDK 17 but actually when i start my server it reply me after few seconds

Can't keep up ! Is the server overloaded ? ...

And also i check the procces with htop and i can see that minecraft take minimum around 30 threads and use all my CPU (400%) so i try to limit the number of thread but that dosent work's ... anyone know what can i do to optimise my minecraft server please ?

Also my shell script for starting my minecraft server : java -jar -server -Xmx4G -Xms1024M -XX:CICompilerCount=4 server.jar nogui

CodePudding user response:

From your timings of your server, there is this line :

1.39%   9,303.90%     4.65 s     4,651.95 ms     0.0           0.0k     World Save

It represent the majority of your issue. Such as it's not because of:

  • plugin: can't fix it quickly (by reporting it to plugin owner/deleting it)
  • Not bukkit event issue
  • Not ticking entity (too many entity)
  • Too much RAM

Such as it's because of save, what can create this issue:

  • RAM: 8Go can take over 50 players (plugins included), so clearly no.
  • Java: JDK 17 is latest so it's difficult to have so several issue I don't think
  • CPU: You talk about this. It's possible, but such as it can run on this type of product, it should not be this, and not over 9k%.
  • Storage: I think you have bad storage. It's not SSD so your entiere server are waiting for the save of it. It can be prooved with this thread on spigotmc.

How can you fix it ?

That's clearly difficult without buying a new storage.

You can try to never save except when there isn't any player for example.

You can also try to reduce all feature that can produce storage save:

  • Upgrade autosave (in bukkit.yml)
  • Render distance (in server.properties)
  • Upgrade despawn of item, arrow... (in spigot.yml)
  • Downgrade spawn limits (in bukkit.yml)
  • Related