💻 Minecraft (Java)
Optimize the server

Optimize Minecraft servers

This guide, unlike many others you can find on the internet, goes straight to the point with clear and concise steps so you can optimize your Minecraft server in the best way possible. If you think there's something we could add, please let us know. If you're looking for a more detailed guide, you can check the recommended guide by Paper for servers with plugins: https://paper-chan.moe/paper-optimization/ (opens in a new tab)

💡

Here are the recommendations and adjustments that we ourselves use to optimize servers for large events and communities. It may vary depending on which Paper fork is used or server specifications, as we generally use servers with many resources for those servers, but in general, the key lies in the parameters we indicate here. These recommendations are based on our experience.

This guide first has some general recommendations that you can apply to servers with mods or plugins alike. Then it has separate sections for servers with plugins and servers with mods that contain specific recommendations for each type of server.

General recommendations

Render distance

📌 It's configured in the server.properties file.

  • simulation-distance: Determines how much of the environment is active around the player. A lower value reduces the server load. A value between 4 and 6 is recommended.

  • view-distance: Defines how many blocks are visible. Keep this value equal to the simulation distance.

server.properties
simulation-distance=5
view-distance=5

Pre-generating chunks

Almost mandatory for Survival mode servers where players will constantly explore the world. Follow our guide to pre-generate chunks on your server here.

Avoid using beta plugins/mods

Make sure that all plugins or mods you use are up to date and compatible with your server version. Avoid using beta or unstable versions that may cause performance issues or are not yet ready for use on servers, but rather in local single-player worlds.

Connection port for Voice Chat

⚠️

If you use the same port for gaming and voice chat, the server will not be able to handle both types of connections on the same port, as voice packets (UDP) take priority over other packets used by the game (TCP), causing disconnections due to timeouts, lag, or high ping.

This is a common mistake. If you use a voice chat plugin or mod, make sure to configure it to use a different port than the one you use to log into the server. This will prevent conflicts and connection issues.

To create an additional port on your server, go to the Network tab in the game panel, where you can create an additional port for voice chat. Then you must configure the voice chat plugin or mod to use that port. If you need help, open a ticket, and we will configure it for you.

Restarting the server periodically

We recommend restarting the server periodically to free up RAM and avoid crashes or unexpected restarts. You can set up a scheduled task from the game panel following this guide here or open a support ticket for assistance.

Servers with plugins

Entity optimizations

📌 It is configured in the bukkit.yml, spigot.yml, and config/paper-world-defaults.yml files. The following are recommended configurations for each file:

bukkit.yml
spawn-limits:
  monsters: 20
  animals: 5
  water-animals: 2
  water-ambient: 2
  water-underground-creature: 3
  axolotls: 3
  ambient: 1
ticks-per:
  animal-spawns: 400
  monster-spawns: 10
  water-spawns: 400
  water-ambient-spawns: 400
  water-underground-creature-spawns: 400
  axolotl-spawns: 400
  ambient-spawns: 400
  autosave: 6000
spigot.yml
world-settings:
  default:
    view-distance: 5
    simulation-distance: 5
    mob-spawn-range: 3
    nerf-spawner-mobs: true
    entity-activation-range:
      animals: 16
      monsters: 24
      raiders: 40
      misc: 8
      water: 8
      villagers: 16
      flying-monsters: 40
      tick-inactive-villagers: false
    entity-tracking-range:
      players: 32
      animals: 32
      monsters: 32
      misc: 24
      display: 32
      other: 32
config/paper-world-defaults.yml
anticheat:
  anti-xray:
    enabled: false
collisions:
  fix-climbing-bypassing-cramming-rule: true
  max-entity-collisions: 2
entities:
  armor-stands:
    do-collision-entity-lookups: false
    tick: false
  spawning:
    despawn-ranges:
      ambient:
        hard: 48
        soft: 24
      axolotls:
        hard: 48
        soft: 24
      creature:
        hard: 48
        soft: 24
      misc:
        hard: 48
        soft: 24
      monster:
        hard: 48
        soft: 24
      underground_water_creature:
        hard: 48
        soft: 24
      water_ambient:
        hard: 48
        soft: 24
      water_creature:
        hard: 48
        soft: 24
    per-player-mob-spawns: true
environment:
  optimize-explosions: true
misc:
  update-pathfinding-on-block-update: false
tick-rates:
  behavior:
    villager:
      validatenearbypoi: 60
      acquirepoi: 120
  sensor:
    villager:
      secondarypoisensor: 80
      nearestbedsensor: 80
      villagerbabiessensor: 40
      playersensor: 40
      nearestlivingentitysensor: 40

Use Aikar's Flags

📌 You can activate them from the Startup tab in the game panel menu.s.

These are Java flags that help optimize RAM usage and are added to your server's startup command. For your convenience, you can activate them yourself from your server's control panel, under the Startup tab. If you want to learn more about these flags, you can check out the Paper documentation: https://docs.papermc.io/paper/aikars-flags/ (opens in a new tab)

Recommended plugins

⚠️

Avoid using plugins to optimize entities, such as ClearLag. Instead, use the entity limitation settings in Paper's configuration. ClearLag may seem useful, but in reality, by massively deleting entities every X amount of time, it causes the server to have to regenerate new entities each time they are deleted, which causes increased CPU and RAM usage, leading to constant TPS drops. Therefore, it is best to avoid using it.

Servers with mods

If you are about to apply these recommendations in a modpack, we recommend that you first check whether this modpack already contains any of these optimizations, as many popular modpacks already include optimization mods and it is not necessary to add them manually.

Optimization mods

💡

You probably won't need all the mods on the list, and some may not be compatible with the different server loaders that exist for mods, such as Fabric, Forge, Quilt, or NeoForge. Therefore, we recommend that you check the compatibility of each mod with your server version and the server loader you are using.

Setup ServerCore

After uploading the ServerCore mod and starting your server, shut it down and enable dynamic optimization in the mod settings to adjust settings in real time based on the server status.

config/servercore/config.yml
features:
  lobotomize-villagers:
    enabled: true
dynamic:
  enabled: true
💡

If you need more aggressive optimization, you can configure it as indicated in the mod documentation: https://github.com/Wesley1808/ServerCore/blob/main/docs/config/OPTIMIZED.md (opens in a new tab)

Using asynchronous mods

It's can be asynchronous, meaning they use different threads on the CPU, while synchronous mods use the same threads as Minecraft. If you have many synchronous mods on your server with little RAM, you may experience performance issues.

Identify the cause of the lag

We recommend the Spark mod for monitoring the server. You can install it on the server and on your client. You can view a guide on how to use Spark.

Avoid using client-side mods on the server

Avoid using mods that are only necessary on the client side, such as graphics mods, shaders, or ambient sound mods. Some examples of these are Optifine, Mouse Tweaks, or map mods. These can cause performance issues on the server and do not contribute anything to the game itself from the server side. If a mod is not necessary on the server, avoid it and only use it on your PC.

Our game panel has a feature in the File Manager to detect client-side mods. You can use it to identify if you have mods that are not necessary on the server and delete them from the server.