性能調整
警告
These docs were written for SpongeAPI 7 and are likely out of date. If you feel like you can help update them, please submit a PR!
Sponge 提供多種效能優化選項,協助你架設在負載重的情況下也能順暢運作的伺服器。
備註
雖然我們嘗試提升所有伺服器的效能,但是提升的程度取決於你的設定。調整完記得測試看看,來確保你的伺服器在效能最佳的狀態。
實體活動範圍
This setting will alter the loading behavior of entities around players. Lowering the value will only load close
entities, while raising it will also load entities that are far away from the player. Lower this to improve your
server's performance, especially with high entity and player counts. To disable activation range for a specific entity
set its value to 0.
小訣竅
It's possible to specify the activation range per mob. You can set auto-populate to true and Sponge
will then add all available mobs to the activation range list, it is advised to disable it after the list is filled.
If you add new mobs to the game, just repeat the procedure and those new mobs will also be added to the list below.
entity-activation-range {
# If enabled, newly discovered entities will be added to this config with a default value.
auto-populate=false
# Default activation ranges used for all entities unless overridden.
defaults {
ambient=32
aquatic=32
creature=32
misc=16
monster=32
}
}
非同步亮度計算
這個設定將會讓亮度檢查在獨立的執行序執行以改善效能。
optimizations {
# Runs lighting updates async.
async-lighting {
# If enabled, runs lighting updates async.
enabled=true
# The amount of threads to dedicate for async lighting updates. (Default: 2)
num-threads=2
}
}
快取可馴服動物的主人
這個設定將會快取可馴服實體的主人 UUID 以減少 data watcher 查詢的時間。
optimizations {
# Caches tameable entities owners to avoid constant lookups against data watchers. If mods cause issue, disable.
cache-tameable-owners=true
}
預先合併掉落物
This setting will pre-process and potentially merge item drops to avoid spawning extra entities that are then merged post-spawning.
optimizations {
# If enabled, block item drops are pre-processed to avoid
# having to spawn extra entities that will be merged post spawning.
# Usually, Sponge is smart enough to determine when to attempt an item pre-merge
# and when not to, however, in certain cases, some mods rely on items not being
# pre-merged and actually spawned, in which case, the items will flow right through
# without being merged.
drops-pre-merge=true
}
Panda 紅石
一個替代的紅石更新演算法,將會減少紅石造成的方塊更新。
optimizations {
# If enabled, uses Panda4494's Redstone implementation which improves performance.
# See https://bugs.mojang.com/browse/MC-11193 for more information.
# Note: This optimization has a few issues which is explained in the bug report. We are not responsible for any issues this may cause.
panda-redstone=false
}
調整自動存檔間格
原版 Minecraft 預設每 900 ticks (45 秒)儲存所有區塊。如果你想提高或降低間格,可以改變伺服器的 global.conf 檔案:
world {
# The auto-save tick interval used when saving global player data.
# Set to 0 to disable. (Default: 900) Note: 20 ticks is equivalent to 1 second.
auto-player-save-interval=900
# The auto-save tick interval used to save all loaded chunks in a world.
# Set to 0 to disable. (Default: 900) Note: 20 ticks is equivalent to 1 second.
auto-save-interval=900
}
Reducing this interval increases the load on your server's CPU and storage, but reduces the data loss that might occur if the server locks up or the power fails. Conversely, increasing the auto-save interval reduces the load on the hardware, but at the expense of increasing the amount of in-game progress that could be lost in case of server failure.
Realtime
啟用這個將會提升當 TPS 低落時的玩家體驗,它不會改善效能。一些特定的實體、方塊實體以及世界時間的更新將會使用真實時間取代以 tick 為基準。
modules {
# Use real (wall) time instead of ticks as much as possible
realtime=false
}
One example of this is baby animals. Normally, they take 20 minutes to grow into an adult. However, if the server is lagging, each animal will receive fewer ticks thus increasing the time they take to grow up. This setting updates some of their logic to use the actual elapsed wall-clock time, rather than number of ticks. It will also apply to block breaking, so no more "breaking blocks multiple times".
拒絕區塊請求
警告
This is an experimental setting for performance gain, we recommend to not enable it when you have mods on the server and to disable it if you experience any issues regarding the loading of tileentities.
world {
# If enabled, any request for a chunk not currently loaded will be denied (exceptions apply for things like world gen and player movement).
# Note: As this is an experimental setting for performance gain, if you encounter any issues then we recommend disabling it.
deny-chunk-requests=false
}
When this option is enabled, mods requesting areas to be loaded to perform various tasks will be denied. Only players and specific world generation calls will be allowed to load new chunks.