パフォーマンスの調整

警告

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 は高負荷な環境でもラグのないサーバーを運営するためのパフォーマンス改善のオプションを提供します。

注釈

サーバーのパフォーマンスを向上させようと私たちが取り組んでいるとはいえ、実際のパフォーマンスはあなたの設定に依存します。 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.

ちなみに

それぞれのモブごとに 有効化範囲を設定できます。 auto-populatetrue に設定すれば、 Sponge はすべての利用可能なモブを有効化範囲リストに追加します。この設定はリストの値を設定したあとに無効化することをおすすめします。ゲームに新たにモブを追加した場合は、同じ手順を踏むことで新たなモブがリストの下部に追加されます。

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 をデータウォッチャーの索引に追加します。

optimizations {
    # Caches tameable entities owners to avoid constant lookups against data watchers. If mods cause issue, disable.
    cache-tameable-owners=true
}

ドロップを事前にまとめる

スポーン直後にまとめられるであろう余計なエンティティのスポーンを避けるため、前処理を行い暗黙のうちにアイテムをまとめてドロップします。

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
}

自動保存間隔の調整

vanilla の Minecraft ではすべてのチャンクを 900tick (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
}

間隔を狭くすることで CPU やストレージへの負荷を増大させますが、サーバーがロックに陥った場合や停電時のデータ破損が減少します。逆に間隔を広くすればハードウェアへの負荷は小さくなりますが、サーバー障害の際に失われるデータが多くなります。

実時間の利用

tick レートが低い場合はこれを有効にすることでより快適にプレイできます。サーバーのパフォーマンスを向上させることにはなりません。エンティティの一部、タイルエンティティ、ワールド時間は更新時に tick の代わりに実時間を利用するようになります。

modules {
    # Use real (wall) time instead of ticks as much as possible
    realtime=false
}

赤ちゃんの動物を例に考えます。これが通常大人になるには20分必要です。しかしながら、サーバーにラグがある場合 tick の速度も減少するため成長にかかる時間が長くなります。この設定はそういった仕組みに tick ではなく実際の経過した時間を適用します。ブロックの破壊にも適用されるので、「同じブロックを何回も壊す」ということがなくなります。

チャンクリクエストの拒否

警告

パフォーマンス向上のための実験的な設定項目であり、タイルエンティティの読み込みに関する問題が発生した場合やサーバーに MOD を導入している場合は無効にしておくことをおすすめします。

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
}

さまざまなタスクを実行するために MOD が行うエリアのロード要求を拒否します。プレイヤーとワールド生成命令のみが新しいチャンクのロードを許可されるようになります。