RE:NODE

Minecraft lag when players join or explore: chunk fix

By RE:NODE Team
20 min read


If a Minecraft server is smooth with nobody moving but stutters the moment a player joins or flies into unexplored land, the cause is one of two things: login work (permissions, data lookups and plugin join handlers, then a burst of chunks sent to the new player) or chunk generation (building terrain that has never existed, which is the most expensive thing the server ever does). They look alike from the player's chair and have different fixes. Run /spark tps while it happens, then /spark profiler start --timeout 120 across two or three joins and one exploration trip, and read what the report names. If it is plugin code, fix or replace the plugin. If it is chunk generation, pre-generate the area with Chunky, lower view-distance, and stop elytra flights outrunning the disk.

This post is about a server that is healthy in steady state and falls over at the edges. It is not a general lag guide - for that, see Minecraft lag diagnosis with spark and the Paper optimisation guide. It assumes Paper, which is what a Minecraft server on RE:NODE runs; the commands and files below are Paper's, and most of the ideas hold for Purpur and Folia with small differences.

Two different problems with the same symptom#

"Lag when people join" and "lag when people explore" get lumped together because the player feels the same thing: movement rubber-bands, blocks take a moment to break, the chat arrives late. Underneath, the server is doing unrelated work.

Join lag is a short spike, usually one to three seconds, at the moment of login. Several things happen in a row. The server authenticates the player (with online-mode=true that includes a call to Mojang's session servers, which is network time rather than server load), reads the player's .dat file from world/playerdata/, and sends the registry and world data. Then it fires events that every plugin can hook: permissions load, an economy plugin fetches a balance, a scoreboard builds, a welcome kit checks a database. Finally it loads and sends the chunks around the player's saved position. If those chunks were unloaded since last time, the server has to read them from disk, and if the world was changed by an upgrade or a border change they may need regenerating.

Exploration lag is sustained while someone moves into territory nobody has visited. Each new chunk must be generated: terrain noise, biomes, caves, ore, structures, then decoration, then lighting. A player flying at elytra speed with a view distance of 10 asks for a fresh strip of roughly twenty-one chunks per row it crosses, many times a second. Generation is CPU-heavy and then writes the result to disk. The cost is per new chunk, so it hits hardest on a fresh world and tapers off as a world fills in.

The two problems also stack. A new player joining at a spawn that has never been loaded, or a returning player whose last position was in a region far from anyone else, causes both at once. That is why the busiest hour after a restart is often the laggiest: everything is cold, every player is a login, and every login needs chunks.

SymptomLikely causeFirst thing to check
One or two seconds of freeze at login, then finePlugin join handlers, data lookupsProfile across several joins
Everyone lags for a few seconds on a joinMain thread blocked by a join handler/spark tps during the join
Lag only while flying or sprinting into the unknownChunk generationChunky and view distance
Lag in the first minutes after a restartCold chunk cache plus many loginsStaggered start, spawn chunks
Periodic hitch every few minutesWorld saving or garbage collectionSee the section on saves below

Prove which one it is#

Guessing is how people spend a weekend tuning the wrong file. Two measurements settle it in an afternoon.

First, watch MSPT (milliseconds per tick), not just TPS. A tick has 50 ms to do its work; if the average stays under that the server reports 20 TPS. A single join that stalls the main thread for 800 ms barely moves the TPS average but is plainly felt. spark's /spark tps shows both, and the MSPT line with its maximum is the one to read.

code
/spark tps/spark healthreport/spark profiler start --timeout 120/spark profiler stop

Run /spark tps the moment you see a stutter, not afterwards. Then start a profile of about two minutes while you cause the problem on purpose: have a test account log in and out three or four times, or take one player and send them flying in a straight line over unexplored ground. The profile gives you a web link with a call tree.

Second, read the report with the right question. Open the call tree for the "Server thread" and look for these names, which vary a little between Paper versions but are recognisable:

  • Something containing PlayerList.placeNewPlayer or PlayerJoinEvent with a plugin's package name under it is join work. The plugin's package (net.luckperms, net.essentialsx, a shop or kit plugin) is the culprit, and the time under it is what that plugin cost.
  • Time under chunk loading and generation frames, such as ChunkMap, ChunkGenerator, NoiseBasedChunkGenerator, ChunkStatus or the structure-placement code, is generation. On current Paper, much of this work runs on worker threads rather than the server thread, so a profile of "Server thread" alone can look innocent while a worker pool is saturating the CPU. In that case also look at the whole process: if CPU is pinned and TPS is dipping, generation is competing for the same cores.
  • Blocking calls from a plugin to a database or web service on the server thread (JDBC frames, HTTP client frames) are the classic join-lag cause. They look like a long, flat bar that is waiting, not computing.

If you are not sure how to read a spark report, the earlier post on spark walks through sources, flat views and the call tree. For the question "is this a chunk problem or an entity problem" there is also Minecraft "Can't keep up!": is the server overloaded?, which explains the console warning that usually accompanies these spikes.

One more trick: the console graph in the RE:NODE panel shows CPU against your plan's limit. Because CPU on a plan is a hard throttle to the share bought (a 1.5 vCPU plan is capped at 150 percent of one core), a flat line pinned at the limit during exploration means chunk generation is hungry and the throttle is what you are feeling. That is an honest signal that the fix is to generate less at peak time, not to hunt for a bad plugin.

Why generating a chunk costs so much#

A chunk is a 16 by 16 column of blocks from the bottom of the world to the top. Creating one from nothing means evaluating several layers of 3D noise, carving caves, placing ores and structures that depend on neighbouring chunks, spreading vegetation and computing light. None of it is cached from last time, because last time it did not exist.

Three consequences matter for a live server.

First, the cost scales with the area a player asks for, which is the square of the view distance. At view-distance=10 each player holds a 21 by 21 square of 441 chunks. At 16 it is 33 by 33, which is 1,089 chunks - nearly two and a half times as many. A player who sprints in a straight line needs a new strip of 21 or 33 chunks every 16 blocks. The arithmetic is in view distance and simulation distance tuning; the short version is that lowering view distance by two steps cuts the generation demand of a traveller more than any other single setting.

Second, generation produces a lot of disk and memory churn. Each new chunk becomes a region file write under world/region/ (r.X.Z.mca), and each loaded chunk is held in RAM until it unloads. A large burst of exploration inflates the heap, which in turn makes the garbage collector work harder, which shows up as a second kind of hitch. If memory is already tight, exploring is where it breaks. See how much RAM a Minecraft server needs for sizing and Java heap space OutOfMemoryError if it has gone as far as errors.

Third, generation is bursty. Averaged over an hour a server may use 30 percent of its CPU, and still hit 100 percent for ten seconds whenever someone crosses a new biome border at speed. Plans are sized for the average and felt at the peak, which is why exploration complaints survive "but the CPU graph looks fine".

Fix 1: pre-generate the area people will actually use#

This is the highest-value change, and it removes exploration lag at the source. Decide the radius your players will realistically travel, put a world border at it, and generate everything inside the border while the server is quiet. The full method, including how big a border should be and what it costs in disk, is in Minecraft world border and Chunky pre-gen. The short working version:

  1. Install the Chunky plugin by placing its jar in plugins/ through the file manager or SFTP, then restart so it loads.
  2. Set the world and the extent. Run each of these from the console:
code
chunky world worldchunky center 0 0chunky radius 3000chunky start
  1. Check on it with chunky progress, and stop and resume with chunky pause and chunky continue. chunky cancel abandons the task; what has been generated so far is kept.

A radius of 3000 blocks is a square roughly 6,000 blocks across, which is around 140,000 chunks. That is a large job on a small plan and may take many hours, so choose the radius with intent rather than copying a number. A new SMP of ten friends rarely needs more than 2,000 or 3,000 blocks in the Overworld in its first months; you can always extend later. Chunky also covers the Nether (chunky world world_nether) and the End, but the Nether is one-eighth scale in practice, so a radius of a few hundred blocks there covers the equivalent of thousands in the Overworld.

Two cautions. Do not pre-generate while players are online on a small plan: generation will compete with them for the CPU limit and you will have created the lag you were trying to cure. Run it overnight, or pause it when people log on. And do not generate to a radius far beyond what you can store; a pre-generated world is large (several GB at these sizes), and your plan has a fixed disk allowance. Check disk use in the panel before starting.

On a RE:NODE Minecraft server you can automate the quiet-hours part, because the panel's Schedules tab runs a console command on a cron expression. A schedule that sends chunky continue at night and another that sends chunky pause in the evening keeps a long job from touching peak hours. Whether Chunky resumes cleanly after a restart depends on its version; check chunky progress after a restart rather than assuming.

If you are on your own machine rather than a host, the same steps apply; the point is only that the work happens on the server's schedule, not the player's.

Fix 2: set a world border so exploration has an end#

An unbounded world is the reason generation never finishes. With a border, "new terrain" stops being infinite. In vanilla, set it from the console:

code
worldborder center 0 0worldborder set 6000worldborder warning distance 50

worldborder set 6000 makes the border 6,000 blocks across, so it reaches 3,000 blocks from the centre, matching the Chunky radius above. Use the same number for both and the border will never ask for a chunk you have not already built. The Nether and End have their own borders, set per dimension while you stand in them or by naming the world in a world-aware plugin.

A border also helps with the nastier exploration cases: elytra flights that outrun the server, boats on a fast ice road, and the single player who decides to walk to 30 million blocks. Without one, one adventurous player on a small plan can degrade the server for everybody. If your server has a real-world community aspect and hard borders feel wrong, a soft compromise is a wide border plus a pre-generated core where the spawn, towns and farms are, so that normal play stays inside what has been built.

Fix 3: lower view distance, and know what you give up#

For a server where players regularly explore, view-distance is the setting you can change without touching a plugin. In server.properties:

server.properties
view-distance=8simulation-distance=6

view-distance is how many chunks around a player are loaded and sent to them; simulation-distance is how many of those actually tick. Lowering the first reduces generation and loading demand and RAM; lowering the second reduces tick time. Vanilla defaults both to 10, and Paper lets you override them per world in its own config, which is useful if you want a small distance in the exploration world and a larger one in a lobby or build world. How the layers interact, and why changing it on a live server needs care, is covered in view distance vs simulation distance.

The cost is real: at 6 chunks of view the horizon is close and some players will complain. Drop in steps of one or two, restart or apply the change, and ask the loudest explorer whether they can live with it. Many servers run 8 happily; some Paper servers go lower and use a plugin or Paper's own setting to keep the client's rendered distance higher than the server's loaded distance, but check your version's documentation, because those settings have moved between releases.

Changing view-distance in server.properties needs a restart on most setups. Paper can change it for a running world through its config reload or a command in some versions; if you are not sure, plan the restart rather than hoping.

Fix 4: Paper's chunk throttles and worker threads#

Paper has settings that control how fast chunks are produced and sent to each player, which spreads a join or exploration burst across more ticks instead of dropping it all at once. The exact names and the file they live in have moved over the years (older versions used paper.yml; current ones split it into config/paper-global.yml and config/paper-world-defaults.yml), so open the file your server generated and search for these rather than pasting a snippet from a forum.

  • Per-player chunk rates - settings named along the lines of player-max-chunk-generate-rate, player-max-chunk-load-rate and player-max-chunk-send-rate. Defaults are normally unlimited or set high by the Paper team. Capping the generate rate (a small number of chunks per second per player) makes one fast flyer unable to monopolise the generator, at the price of the world appearing more slowly around them. This is the closest thing to a direct cure for "one elytra player lags everyone".
  • The chunk system's thread settings - in paper-global.yml there is a chunk-system section with options for worker threads, generation parallelism and IO threads. Paper picks values from the CPU it sees. On a container with a throttled CPU share, the machine's visible core count can be higher than what you are allowed to use, so the automatic choice may overshoot. If a profile shows many generation workers fighting over a small CPU allowance, setting these explicitly to match your plan is worth testing. Treat the defaults as correct until a profile shows otherwise.
  • Auto-save pacing - Paper saves chunks gradually, and a setting around max-auto-save-chunks-per-tick controls how many per tick. A periodic hitch every few minutes is often saving. Spreading it out makes the hitch smaller but longer; the default is usually fine.

Change one thing at a time, and take a fresh spark profile before and after. A change you cannot measure is a guess.

Fix 5: make joining cheap#

When the profile points at join, the work is mostly outside Minecraft's own code, which is good news because plugin problems are fixable.

Look at what runs on PlayerJoinEvent: permissions loading, a welcome message that queries a database, a "daily reward" lookup, scoreboard and tab list rebuilds, resource pack prompts, anti-cheat initialisation. A plugin that talks to MySQL on the server thread freezes the whole tick while it waits. The healthy pattern is to do slow lookups asynchronously, during the login phase, rather than on the main thread after the player appears. Not every plugin does, and the profile will tell you which does not.

Practical steps, in order:

  1. Update the offending plugin. Slow join handlers are common bug reports and are often already fixed.
  2. Check its database settings. If the database is far away or slow, every join pays that round trip. A database on the same host or on a nearby plan responds in under a millisecond or two; one across the internet can take tens. RE:NODE game servers include a database slot, created in the panel with a generated host, user and password, which keeps the lookup local to the platform. See using MySQL for Minecraft plugins for the setup.
  3. Remove plugins that duplicate work. Two permission-loading plugins, or a kit plugin and a rewards plugin that both query on join, double the cost.
  4. Trim the join message pipeline. A long chain of /title, particle and sound effects triggered by each join, multiplied by a restart rush of twenty players, adds up. See join and quit messages for ways to keep it light.
  5. If it still hurts, stagger the load. After a restart players reconnect all at once. A short whitelist-only window, or simply restarting at a quiet hour, avoids the thundering herd.

Resource packs are a separate and often misattributed cause: a large server resource pack makes the client download or re-verify at join, so the player sees a long stall that is not server lag at all. If the profile is clean and only the joiner is waiting, look there first. MOTD, icon and resource packs covers hosting and sizing the pack.

Fix 6: spawn chunks, cold caches and saves#

A few smaller things round out the picture.

Spawn chunks. Historically Minecraft kept a block of chunks around the world spawn permanently loaded. Newer versions made this configurable (a gamerule named spawnChunkRadius in recent releases, and a keep-spawn-loaded option in Paper's world config on versions that have it). Keeping a small area loaded makes the most common join location fast, because new players arrive at a warm spawn. Setting it to zero saves memory on a lobby-heavy network but makes each first join colder. The details are in spawn protection and spawn chunks.

Storage speed. Loading and saving chunks is disk work, and the difference between slow and fast storage is felt in exactly these moments. RE:NODE servers run on NVMe, which helps loading and the pause during a save, but it does not make generation free; that part is CPU. If you are on spinning disks elsewhere, this is the first place you will notice it.

Synchronous chunk writes. server.properties contains sync-chunk-writes, default true in vanilla, which flushes each chunk write to disk before continuing. Setting it to false can smooth hitches on slow disks at a small risk if the process is killed mid-write. On fast storage the gain is small, and the risk is the kind that costs a world, so leave it alone unless a profile shows the main thread waiting on disk. If you are worried about corruption in general, chunk errors and world corruption explains what the failures look like.

Garbage collection. A heap that is too small, or flags that are wrong for the Java version, produces pauses that are easy to mistake for chunk lag. A correct set of JVM flags and enough memory removes them; see JVM flags and Java versions. RE:NODE's Minecraft install picks the Java version to match the server version, so the first thing to check is not the Java version but whether the heap is full.

Entities and farms. Many chunk problems are really entity problems: a freshly loaded chunk with 300 animals, or a mob farm that wakes up when a player arrives, costs more than the terrain does. If the report names entity ticking underneath the chunk load, move to mob farm lag or entity cleanup.

A worked example#

Here is how a realistic investigation goes on a small survival server, 12 players on the 4 GB Standard plan, view distance left at the default 10.

Complaint: "lag every time someone logs in, and it's terrible when Sam flies off with his elytra."

  1. During a login, /spark tps shows MSPT jumping from about 12 to 400 ms for a second. The average TPS stays at 20, which is why nobody noticed in the console. The stutter is real.
  2. A two-minute profile across four test logins names a shop plugin under PlayerJoinEvent, taking most of those 400 ms in a database call. Updating the plugin and pointing it at the local database slot cuts the stall to under 50 ms. The join half of the complaint is fixed without touching Minecraft.
  3. For Sam, the console graph shows CPU pinned at the plan's limit for about thirty seconds each flight, with the Server thread profile showing little. The work is on generation threads. The world is two months old and the border is not set.
  4. A border of 4,000 blocks is set, and Chunky generates a radius of 2,000 across two nights on the quiet-hours schedule. The next flight inside 2,000 blocks costs almost nothing, because the chunks load from disk.
  5. View distance drops from 10 to 8 in server.properties at the next restart, and the per-player generate rate in Paper's config is capped so that a flight beyond the pre-generated area is slower and smoother rather than a freeze.

Nothing here needed a bigger plan. That is typical: edge lag is nearly always scheduling and configuration, not raw capacity. If CPU is pinned at the limit during normal play, not just at exploration, that is a different conversation - Minecraft plans and their limits lists what each tier includes.

Backups before you change things#

Most of the steps above are safe, but pre-generation and border changes touch the world folder, and trimming or regenerating can go wrong. Take a backup first. The Backups tab on a RE:NODE server makes one on demand, lets you lock it so rotation does not remove it, and restores with a button; the world generated by Chunky is large, so remember each backup takes space and each plan has a fixed number of backup slots. Scheduled restarts and automatic backups shows how to run a restart and a backup on a schedule, and world backup and restore covers the restore side. A backup nobody has restored is a hypothesis; restore one to a test server before you rely on it.

FAQ#

Why does my Minecraft server lag only when someone joins?

Because login runs plugin code and loads chunks around the player on a busy tick. A plugin that waits for a database or web call on the main thread freezes everyone for the length of the wait. Profile several joins with spark and look under PlayerJoinEvent for a plugin name.

Why does exploring new terrain lag the server?

Every new chunk has to be generated from scratch, which is much more expensive than loading one from disk. Fast travel by elytra, boat or horse asks for a fresh strip of chunks every few blocks. Pre-generating the area with Chunky and setting a world border moves that cost to a time of your choosing.

Does a lower view distance reduce chunk loading lag?

Yes, it is the most direct lever. The number of chunks a player holds grows with the square of the view distance, so going from 10 to 8 cuts a player's area from 441 chunks to 289. Lowering simulation-distance helps tick time, but the load and generation cost follow view-distance.

How long does pre-generating a world take?

It depends on the radius and the CPU you have. A radius of a few thousand blocks is tens of thousands to over a hundred thousand chunks and can take many hours on a small plan. Run it overnight, check chunky progress, and pause it with chunky pause when players are online.

Will more RAM fix lag when players explore?

Only if memory is the actual bottleneck. Generation is mostly CPU work, so extra RAM does not speed it up. It helps when the heap is nearly full and garbage collection pauses are the real hitch. Check the memory graph and a spark health report first.

Is the lag after a restart the same problem?

Largely, yes. After a restart every chunk is cold and every player logs in at once, so you get the join and loading cost together. Restarting at a quiet hour, keeping a small spawn area loaded and keeping join handlers cheap all reduce it.

Was this helpful?