How to Optimize Minecraft Server Performance with Aikar’s Flags
Aikar’s Flags are JVM startup parameters that improve server performance by optimizing garbage collection and memory management. They reduce lag spikes and provide smoother gameplay. All berrybyte Minecraft servers come with Aikar’s flags by default.Aikar’s Flags allocates all available memory, so your server may appear to use 100% RAM. This is normal. Install the Spark plugin and run
/spark health to see actual usage.Setting Up the Flags
Update your server startup command with the flags below. Replace{SERVER_MEMORY} with your RAM amount (e.g., 4096 for 4GB).
Less than 12GB of RAM
JVM Flags
12GB of RAM or more
JVM Flags
Flag Breakdown
On shared hosting (like berrybyte), leave about 1GB for JVM overhead. This is done automatically.
-Xmx/-Xms: Maximum and initial memory (set to same value)-XX:+UseG1GC: Enables G1 garbage collector for better performance-XX:+ParallelRefProcEnabled: Parallel reference processing-XX:MaxGCPauseMillis: Maximum garbage collection pause time-XX:+DisableExplicitGC: Prevents bad plugin code from affecting GC
server.log for error messages.
Common Issues
Server shows 100% RAM usage- Normal behavior - flags allocate all available memory
- Fix: Use Spark plugin and run
/spark healthfor actual usage
- Usually caused by
-XX:+AlwaysPreTouchin containers - Fix: Remove
-XX:+AlwaysPreTouchflag
- Incorrect memory allocation or wrong Java version
- Fix: Use Java 11+ and leave 1GB for JVM overhead
Related Guides
- Changing Minecraft Versions - Switch versions
- Connection Timeout Fix - Fix connection issues
- Chunky Plugin - Pre-generate chunks
- Control Panel Overview - Monitor performance