JoinGG

Pregenerating a world, and why the border comes first

Terrain generation is the most expensive thing a server does. Move it to a time nobody is playing, and set the edge before you start.

SweetMask · 4 min read

Terrain generation is the most expensive thing a Minecraft server does. Every chunk a player walks into for the first time has to be built (heightmap, caves, structures, ores, decoration) and it happens on demand, while everyone else is waiting.

Pregeneration moves that cost to a time when nobody is playing. It is the single largest performance improvement available to a survival server, and the order of operations matters more than the tool you use.

The border comes first

Set the world border before you pregenerate. Not after.

/worldborder set 5000 gives you a 5,000-block square centred on spawn. Pregenerate that area and you are finished: every chunk a player can reach already exists.

Without a border there is no edge, so there is nothing to finish. You pick an arbitrary radius, generate it, and then the first person who walks past it hits ungenerated terrain, and hits it alone, far from spawn, where the lag spike is entirely theirs and looks like the server breaking.

The border is what turns pregeneration from a mitigation into a solution.

How big is big enough

Smaller than instinct suggests. A 5,000-block square is 25 million blocks of surface, which is more than a server of twenty people will meaningfully explore in a year.

The cost of getting this wrong is asymmetric. Too small can be raised later with a single command and a top-up generation run. Too large means generating terrain nobody will ever see, paying for the disk it sits on, and waiting hours longer than necessary.

The world border is documented on the Minecraft Wiki, including the warning distance and the damage settings, which are worth setting so players understand what they are walking into rather than hitting an invisible wall.

What it actually costs while running

Pregeneration saturates the CPU and writes continuously to disk. On a shared or containerised host this is exactly the profile that gets you throttled or noticed, and on a box with neighbours it is antisocial.

Run it with the server empty. Run it overnight. On a rented plan, check whether sustained full-CPU use for several hours is something your host tolerates — many do not, and finding out afterwards is worse than asking, which is part of what you are actually buying beyond the advertised specs.

The disk you will need

A pregenerated 5,000-block square is a few gigabytes depending on version and settings. That is not large, but it is permanent, and it arrives all at once.

A server on a plan with 10GB of storage that pregenerates a large area can fill the disk during the run, which stops the generation and can leave region files half-written. Check free space before starting, and check it again during — this is one of the few times a server genuinely can fill a disk in an afternoon, and the general case is worth its own attention in keeping the disk from filling.

The nether is a separate job

Every dimension generates separately, and the nether is the one people forget. It is also the one where the oversight hurts most: the nether is compressed eight to one against the overworld, so a short walk there crosses a lot of overworld distance and generates a lot of chunks.

A server with a pregenerated overworld and an untouched nether has moved its worst lag spike rather than removed it, and moved it somewhere players go in groups. Generate both, and remember the border is per-dimension too: a 5,000-block overworld border corresponds to roughly 625 blocks of nether.

Getting that ratio wrong is how people end up with a nether border that players hit within a week of the overworld feeling enormous.

What it does not fix

It does not help with lag caused by entities, redstone or plugins. Those are ongoing costs and pregeneration is a one-off.

The tell is timing. If the stutter happens when someone explores, it is generation and pregeneration fixes it. If it happens when the server has been up for six hours regardless of what anyone is doing, the cause is accumulation, and that belongs in a different diagnosis entirely.

What pregeneration does not fix

It is worth being clear about which stutters this removes, because the expectation frequently exceeds the effect.

Pregeneration removes the cost of creating terrain. It does not remove the cost of loading it, which still means reading from disk, decompressing, and handing chunks to the tick loop as players move. A pregenerated world on a slow disk still stutters when somebody travels quickly, and the symptom looks identical to the one that was supposed to have been solved.

It also does nothing for the two commonest sources of lag on an established server: entity density and whatever a plugin is doing every tick. Those are unrelated problems that happen to produce the same complaint from players, which is why a server that pregenerated and saw no improvement was almost always diagnosing the wrong thing.

The honest summary is that pregeneration is a fix for new terrain specifically, it is very effective at that, and it is worth doing once for that reason rather than as a general performance measure.

Doing it again later

Raising the border means generating the new ring. The same rules apply: empty server, off-peak, watch the disk.

Announce it, because a border that moves outward is genuine news on a survival server: it is new land, and new land is the cheapest content a server ever gets. Servers that grow their border on a schedule give their regulars something to look forward to without anyone writing a plugin, which is a better retention lever than most of what gets built for the purpose and sits closer to what keeps people coming back than to server administration at all.

Tags
minecraftperformanceworld
Share

SweetMask

Published · 4 min read

All articles

Keep reading

Guides · Minecraft

Paper configuration beyond server.properties

Three more files hold the settings that decide whether a busy server runs well. Which entries matter, and which ones hide a problem.

· 4 min read
Guides · Minecraft

When a Minecraft proxy is the wrong answer

Velocity and BungeeCord solve one problem and bring three. The honest threshold for needing a proxy, and what it never fixes.

· 3 min read
Guides · Minecraft

The Minecraft server list ping, end to end

Five packets decide your MOTD, your icon and your player count on every listing. Three common mysteries, solved by reading them.

· 3 min read