If your Minecraft server freezes for a few seconds at a time instead of lagging steadily, a structure search is a good first suspect. The search runs on the main thread, so the whole server waits until it finishes.
What it looks like in a Spark report
In a Spark profile, look under the server thread for frames with names like findNearestMapStructure. If they take a few percent of the tick or more, structure searches are costing you real time.
The pattern to watch for is spikes rather than a steady load. The average tick time can look fine while a few ticks last seconds, which players feel as the server freezing.
Searches start when players use /locate, throw eyes of ender, open explorer maps, or trade with villagers who sell them. Mods can also trigger them.
What to try, in order
Reduce structure searches
Test firstFinding the nearest village, ruin or other structure is one of the slowest things the server does. It happens when players use /locate or eyes of ender, open explorer maps, or trade with some villagers.
- Check for commands, plugins or datapacks that call /locate on a timer or on every trade.
- If villagers sell explorer maps, limit how many are traded, or pre-generate the area around spawn with Chunky so the search is shorter.
Pre-generate the world with Chunky
SafeMaking new terrain is one of the most expensive things a server does. Doing it ahead of time, when nobody is online, stops it happening in the middle of play.
- Install Chunky, then run /chunky center, /chunky radius <blocks> and /chunky start.
- Do it while the server is quiet. It uses a lot of CPU until it finishes.
- Set a world border to match so players cannot wander past the pre-generated area.
Take a longer profile during the lag
SafeThe profile is short or does not show where the time goes, so the cause is a guess.
- Run /spark profiler start, wait 10 to 15 minutes while the lag is happening, then /spark profiler stop.
- Send that new link.
What to leave alone
- Adding more memory. A structure search is a pause on the main thread, not a memory problem.
- Adding more CPU cores. The main loop runs on one core, so extra cores do not shorten a single search.
A real case. On Emberwild, our Cobblemon server, a launch event with 10 to 18 players brought severe lag, with the server running about 700 to 1,000 ticks behind in places. One of the causes we found was a structure-locating feature in a mod that triggered vanilla's expensive search over a very wide radius. It caused freezes lasting from several seconds up to 89 seconds. We found it by reading a Spark profile, not by guessing.
Paste your Spark link
Get a plain-English diagnosis, ranked fixes labelled Safe, Test first or Risky, and a reply you can send. Free, read-only, no logins.
By continuing you agree to the terms and privacy notice. We keep the diagnosis, not your raw profile.
Common questions
Why does my server freeze when someone uses an explorer map?
The server has to search for the nearest matching structure, and that search runs on the same thread as everything else. While it runs, the rest of the server waits, so everyone feels a freeze.
Can I turn off structure searches?
You can reduce how often they happen by checking which commands, plugins, mods or villager trades trigger them. You cannot make vanilla's search itself cheaper. Pre-generating the area around spawn can shorten the search.
How do I know it is structure searching and not something else?
Take a Spark profile that covers a freeze and look for frames such as findNearestMapStructure under the server thread. If you cannot find them, paste your Spark link into Pirdel and it will check for this pattern.