Java's default settings aren't made for game servers. The right startup flags cut lag spikes from garbage collection. Pick your memory and server software to get a tuned start command and a ready-made start script.
Which Flags Should I Use?
- Aikar's flags (G1GC) are the long-standing recommendation from the Paper team for Paper, Purpur, Spigot and vanilla servers, and work well for modded servers too.
- ZGC keeps pauses tiny even with very large heaps. It needs Java 21 or newer and a bit more spare memory, so it suits servers with 16 GB or more.
- Velocity proxies have their own small set of recommended flags.
Memory Tips
- Set the minimum (
-Xms) and maximum (-Xmx) to the same value, as these flags expect. - Leave memory for the operating system and Java itself: on a host or panel with a memory limit, use about 1–1.5 GB less than the limit.
- More memory isn't always better. See the Server RAM Calculator for a sensible amount.