What to check when your Minecraft server lags
How to find what slows a server down: tick rate, view distance, new chunks, entities and plugins.
1. Measure first
On Paper and Purpur, type tps in the console. 20 is full speed, and players notice anything under 18. mspt shows how long one tick takes: above 50 ms the server cannot keep up.
If the numbers are fine and one player lags, the cause is that player's connection or computer.
2. Lower the distances
In server.properties, view-distance and simulation-distance set how much of the world is loaded and kept running around each player. Both are 10 by default. With 8 and 6 the server has much less to do and players see little difference. Restart after the change.
3. Generate the world ahead
Creating new terrain is the heaviest work a server does. A pre-generation plugin such as Chunky creates an area once, in the background, so that players who explore later load finished chunks.
4. Find what costs time
The spark plugin records what the server spends its ticks on. Type spark profiler start, play for a few minutes, type spark profiler stop and open the link it prints. Common causes are farms with hundreds of animals or dropped items, redstone clocks, and a plugin that does heavy work on every tick.
5. Memory
A server that stops with an out of memory error, or pauses for seconds at a time, needs more memory. Large modpacks and many players at once are the usual reasons. More memory does not speed up a server that is slow for the reasons above.