我正在尝试使用 systemd 服务在 Ubuntu 16.04 上启动时运行我的 minecraft 服务器。我创建的服务可以运行,但它的 CPU 使用率过高。如果我单独运行 minecraft 服务器,它的 CPU 使用率通常只有个位数。当我通过服务运行它时,它一直处于 100% 的状态。有什么办法可以解决这个问题吗?
我用来提供服务的链接:这里
systemd .service 文件
[Unit]
Description=Minecraft Server
[Service]
WorkingDirectory=/home/minecraft/world
User=user
Group=user
Restart=on-failure
RestartSec=20 5
ExecStart=java -jar spigot-1.9.4.jar nogui
[Install]
WantedBy=multi-user.target
输出:
user@server:~$ systemctl status minecraft-server.service
● minecraft-server.service - Minecraft Server
Loaded: loaded (/etc/systemd/system/minecraft-server.service; disabled; vendor preset: enabled)
Active: active (running) since Sat 2017-03-25 21:38:41 EDT; 11s ago
Main PID: 3337 (java)
CGroup: /system.slice/minecraft-server.service
└─3337 /usr/bin/java -jar spigot-1.9.4.jar nogui
Mar 25 21:38:47 Server java[3337]: [21:38:47 INFO]: Zombie Aggressive Towards Villager: true
Mar 25 21:38:47 Server java[3337]: [21:38:47 INFO]: Experience Merge Radius: 3.0
Mar 25 21:38:47 Server java[3337]: [21:38:47 INFO]: Preparing start region for level 0 (Seed: -2292665518101882972)
Mar 25 21:38:48 Server java[3337]: [21:38:48 INFO]: Preparing spawn area: 58%
Mar 25 21:38:49 Server java[3337]: [21:38:49 INFO]: Preparing start region for level 1 (Seed: -2292665518101882972)
Mar 25 21:38:49 Server java[3337]: [21:38:49 INFO]: [WorldEdit] Enabling WorldEdit v6.1.3;7a097ca
Mar 25 21:38:49 Server java[3337]: [21:38:49 INFO]: WEPIF: Using the Bukkit Permissions API.
Mar 25 21:38:50 Server java[3337]: [21:38:50 INFO]: [WorldEdit] Using com.sk89q.worldedit.bukkit.adapter.impl.Spigot_v1_9_R2 as the Bukkit ada
Mar 25 21:38:50 Server java[3337]: [21:38:50 INFO]: Server permissions file permissions.yml is empty, ignoring it
Mar 25 21:38:50 Server java[3337]: [21:38:50 INFO]: Done (3.139s)! For help, type "help" or "?"
lines 1-17/17 (END)
答案1
添加 --noconsole 解决了我的问题。在这里找到答案:https://www.spigotmc.org/threads/high-cpu-usage-solved.87634/