Back to Home

Minecraft Server Optimization Guide

Complete guide to optimizing your Minecraft server for maximum performance. Updated for 1.21.5.

Based on community research and testing. Originally compiled from SpigotMC optimization guides.

Introduction

There is no one-size-fits-all guide that will give you perfect results. Each server has unique needs and limits on how much you can or are willing to sacrifice. Tinkering with options to fine-tune them to your server's needs is what it's all about.

This guide aims to help you understand what options have an impact on performance and what they change. If you're on vanilla, Fabric, or Spigot (not Paper), go to your server.properties and change sync-chunk-writes to false. This is automatically disabled on Paper and its forks.

Choosing Server Software

Your choice of server software makes a huge difference in performance and API possibilities.

Recommended Server JARs

Paper

The most popular server software that aims to improve performance while fixing gameplay and mechanics inconsistencies.

papermc.io

Purpur

Paper fork focused on features and freedom of customization. Includes additional performance options.

purpurmc.org

Software to Avoid

  • Any paid server JAR claiming async anything - 99.99% chance of being a scam
  • Bukkit/CraftBukkit/Spigot - Extremely outdated in terms of performance
  • Plugins that enable/disable other plugins at runtime - Causes fatal errors and data tracking issues
  • Downstream forks beyond Paper/Purpur - Often encounter instability and issues

Map Pregeneration

Map pregeneration is now only useful on servers with terrible, single-threaded, or limited CPUs. Thanks to various optimizations added over the years, chunk generation is much more efficient. However, pregeneration is still commonly used for world-map plugins like Pl3xMap or Dynmap.

If you want to pregen, use Chunky. Make sure to set up a world border so players don't generate new chunks!

Important

Set up a vanilla world border (/worldborder set [diameter]) as it limits certain functionalities like treasure map lookups that can cause lag spikes.

Network Settings

server.properties

network-compression-threshold

Recommended: 256

Sets the cap for packet size before compression. Higher values save CPU at the cost of bandwidth. Set to -1 to disable (good if your server is behind a proxy with <2ms ping).

purpur.yml

use-alternate-keepalive

Recommended: true

Sends keepalive packets once per second and only kicks for timeout if none were responded to in 30 seconds. Prevents players with bad connections from getting timed out as often.

Chunk Settings

server.properties

simulation-distance

Recommended: 4

Distance in chunks around the player that the server will tick. This includes furnaces smelting, crops growing, etc. Set this low (3-4) because of view-distance existence.

view-distance

Recommended: 7

Distance in chunks that will be sent to players. Total view distance equals the greater of simulation-distance and view-distance.

paper-world-defaults.yml

delay-chunk-unloads-by

Recommended: 10s

How long chunks stay loaded after a player leaves. Prevents constant loading/unloading when players move back and forth.

prevent-moving-into-unloaded-chunks

Recommended: true

Prevents players from moving into unloaded chunks, avoiding sync loads that cause lag. More important with lower view-distance.

Mob Settings

bukkit.yml - spawn-limits

spawn-limits:
  monsters: 20
  animals: 5
  water-animals: 2
  water-ambient: 2
  water-underground-creature: 3
  axolotls: 3
  ambient: 1

The math is [playercount] × [limit]. Lower values = fewer mobs. This is a double-edged sword - fewer mobs means less server work, but mobs are important for gameplay.

bukkit.yml - ticks-per

ticks-per:
  monster-spawns: 10
  animal-spawns: 400
  water-spawns: 400
  water-ambient-spawns: 400
  water-underground-creature-spawns: 400
  axolotl-spawns: 400
  ambient-spawns: 400

How often (in ticks) the server attempts to spawn certain entities. Water/ambient mobs don't need to spawn each tick.

spigot.yml

mob-spawn-range

Recommended: 3

Range in chunks where mobs spawn around players. Lower values make it feel like more mobs around you. Should be ≤ simulation-distance.

entity-activation-range

entity-activation-range:
  animals: 16
  monsters: 24
  raiders: 48
  misc: 8
  water: 8
  villagers: 16
  flying-monsters: 48

Distance from player for entities to tick. Lower values help performance but may cause unresponsive mobs. Too low can break iron farms.

nerf-spawner-mobs

Recommended: true

Makes mobs from spawners have no AI. They'll do nothing, which is often fine for mob farms.

paper-world-defaults.yml

per-player-mob-spawns

Recommended: true

Mob spawns account for mobs already around each player. Provides more singleplayer-like spawning and fixes issues with farms taking the entire mobcap.

max-entity-collisions

Recommended: 2

How many collisions one entity can process. Value of 0 disables pushing. Value of 2 is usually sufficient.

update-pathfinding-on-block-update

Recommended: false

Disabling reduces pathfinding calculations. Mobs will passively update their path every 5 ticks (0.25 sec) instead.

Villager Optimization (purpur.yml)

villager.lobotomize.enabled

Recommended: true (only if villagers cause lag)

Lobotomized villagers are stripped of AI and only restock offers periodically. Enables automatically for villagers that can't pathfind.

villager.search-radius

villager:
  search-radius:
    acquire-poi: 16
    nearest-bed-sensor: 16

Reduces the radius villagers search for job sites and beds. Significantly improves performance with many villagers.

Miscellaneous Settings

spigot.yml - merge-radius

merge-radius:
  item: 3.5
  exp: 4.0

Distance between items/exp orbs to merge. Reduces items on ground. Too high makes items seem to disappear and can teleport through blocks.

Hopper Optimization

hopper-transfer / hopper-check (spigot.yml)

Recommended: 8 for both

Time in ticks hoppers wait to move/check for items. Increasing helps with lots of hoppers but may break hopper-based clocks.

hopper.disable-move-event (paper-world-defaults.yml)

Recommended: false

Only set to true if you have no plugins listening to InventoryMoveItemEvent. Do NOT enable if using protection plugins!

paper-world-defaults.yml

redstone-implementation

Recommended: ALTERNATE_CURRENT

Replaces redstone system with faster versions that reduce redundant block updates. May introduce minor inconsistencies with very technical redstone.

optimize-explosions

Recommended: true

Uses faster explosion algorithm with slight inaccuracy in damage calculation. Usually not noticeable.

treasure-maps.enabled

Recommended: false

Generating treasure maps is expensive and can hang the server if structures are in ungenerated chunks. Only enable if you've pregenned and set world borders.

anti-xray.enabled

Recommended: true

Hides ores from x-rayers. Decreases performance slightly but is much more efficient than anti-xray plugins.

Java Startup Flags

Minecraft 1.20.5+ requires Java 21 or higher. Recommended vendors are Adoptium and Amazon Corretto.

Your garbage collector can be configured to reduce lag spikes caused by GC tasks. Aikar's flags are the recommended starting point for Minecraft servers.

Generate Optimized Flags

Use our flags generator to get the correct startup flags for your server configuration.

Open Flags Generator

Plugins to Avoid

Ground Item Removal Plugins

Unnecessary - use merge-radius and alt-item-despawn-rate instead. These plugins use more resources scanning and removing items than just letting them despawn naturally.

Mob Stacker Plugins

Stacking naturally spawned entities causes more lag than not stacking due to constant spawn attempts. Only acceptable for spawner-heavy servers.

Plugin Enable/Disable at Runtime

Extremely dangerous. Loading plugins at runtime can cause fatal data tracking errors. Disabling can cause dependency errors. The /reload command has the same issues.

Measuring Performance

/mspt

Paper command that shows how long ticks take to calculate. If values are under 50, your server isn't lagging. The third value being over 50 occasionally is normal.

Spark

Spark is a plugin for profiling CPU and memory usage. Essential for finding the cause of lag spikes and performance issues.

Need Pre-Optimized Server Hosting?

Skip the configuration hassle. Our servers come pre-optimized with Paper/Purpur, proper JVM flags, and tuned settings out of the box.