Keeping a Minecraft server running smoothly at 20 TPS (ticks per second) is challenging, especially with newer versions such as 1.21+. With the right settings, however, you can get much more performance from your hardware.
1. Choose the Right JAR
For better performance than Vanilla or CraftBukkit, consider optimized Spigot forks. The main options are:
- Paper: The industry standard. Fixes bugs, patches exploits and significantly improves performance.
- Purpur: Based on Paper, with more gameplay settings and aggressive optimizations.
2. Aikar's Flags: The Java Secret
Java startup flags control how RAM is managed through garbage collection. The default Java flags can cause periodic freezes. Aikar's Flags are a community-tested set of arguments that help smooth out memory usage.
java -Xms10G -Xmx10G -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200...
3. World Pre-generation
Generating new chunks is one of the most demanding tasks for a server. When a player explores a new area, the server has to create terrain from scratch, causing lag. Use a plugin such as Chunky to pre-generate the world before opening it to the public.
Pro Tip: View Distance
"Reducing 'view-distance' in server.properties from 10 to 6 or 7 can save up to 40% in processing power without significantly affecting gameplay."