What are JVM Arguments?
JVM (Java Virtual Machine) arguments are startup flags that control how Java runs your Minecraft server. These flags configure memory allocation, garbage collection, and runtime optimizations that can dramatically impact your server's performance.
Properly configured JVM arguments can:
- Reduce lag spikes from garbage collection
- Improve tick rate consistency
- Lower memory usage overhead
- Increase overall server performance
- Prevent crashes from memory issues
Why JVM Arguments Matter for Minecraft
Minecraft servers are notoriously demanding on the JVM due to their unique workload patterns:
Short-lived Objects: Most game objects (entities, block updates) are created and destroyed rapidly, making garbage collection frequency critical.
Tick-Based Execution: Minecraft runs on a strict 20 TPS (ticks per second) cycle. Any garbage collection pause over 50ms causes noticeable lag.
Large Heap Sizes: Servers with many players and chunks loaded require 4GB-16GB+ of RAM, making garbage collector choice critical.
Popular Flag Presets
Aikar's Flags (Most Recommended)
Aikar's flags are the most battle-tested JVM arguments for Minecraft, used by thousands of servers including large networks.
Key Features:
- Optimized for G1GC (Garbage First Garbage Collector)
- Tuned specifically for Minecraft's memory patterns
- Proven to reduce lag spikes by 70%+ on average
- Works well with 2GB-32GB RAM allocations
Best For:
- Paper, Purpur, Spigot servers
- Vanilla servers with 4GB+ RAM
- SMP and survival servers
- Most production environments
Aikar's flags are the safest choice for most servers. They've been refined over years based on real-world performance data.
MeowIce Flags (Modern Java 17+)
MeowIce flags are a more recent optimization targeting Java 17 and newer versions with updated GC tuning parameters.
Key Features:
- Leverages Java 17+ garbage collection improvements
- More aggressive young generation sizing
- Lower pause time targets
- Better performance on modern CPUs
Best For:
- Java 21 servers (recommended)
- Purpur and Paper servers
- PvP servers requiring low latency
- Servers with consistent player counts
GraalVM Flags
Optimized for the GraalVM JIT compiler, offering potential performance gains through advanced compilation.
Key Features:
- Enhanced JIT compilation
- Better string deduplication
- Compressed object pointers
- Potential 10-15% performance boost
Best For:
- GraalVM distributions only
- High-performance requirements
- Advanced users willing to test
GraalVM flags require the GraalVM JDK distribution. They won't work with standard OpenJDK or Oracle JDK.
RAM Allocation Guidelines
Choosing the right RAM allocation is critical for performance:
Small Servers (5-20 Players)
Recommended RAM: 3-4GB Flag Preset: Aikar Flags - Low RAM Notes: Perfect for friend servers and small SMPs
Medium Servers (20-50 Players)
Recommended RAM: 6-8GB Flag Preset: Aikar Flags - Medium RAM or MeowIce Flags Notes: Suitable for public servers with moderate player counts
Large Servers (50-100 Players)
Recommended RAM: 10-16GB Flag Preset: Aikar Flags - High RAM or MeowIce Flags Notes: Consider dedicated hardware and chunk pregeneration
Network/Proxy Servers (100+ Players)
Recommended RAM: 16GB+ per backend server Flag Preset: MeowIce Flags with low-latency profile Notes: Distribute load across multiple backend servers
Allocating too much RAM can hurt performance due to longer garbage collection times. Use only what you need.
Java Version Considerations
Java 17 (LTS)
- Stable and well-tested
- Full Minecraft 1.18+ support
- Good compatibility with mods
- Recommended for Forge servers
Java 21 (LTS - Recommended)
- Latest LTS version
- Best garbage collection performance
- Required for Minecraft 1.20.5+
- Recommended for Paper/Purpur
Java 23
- Bleeding edge features
- Experimental improvements
- May have mod compatibility issues
- Use only if you need specific features
Java 21 offers the best performance for modern Minecraft versions. Stick with Java 17 only if running Forge mods that don't support Java 21.
Garbage Collection Algorithms
Understanding garbage collectors helps you choose the right flags:
G1GC (Default - Recommended)
Pros:
- Well-balanced for Minecraft workloads
- Predictable pause times
- Excellent tuning documentation
- Works well with 4GB-64GB heaps
Cons:
- Can have occasional long pauses with huge heaps (64GB+)
ZGC (Low Latency)
Pros:
- Ultra-low pause times (sub-millisecond)
- Scales to multi-TB heaps
- Never stops-the-world
Cons:
- Requires Java 21+
- Higher CPU overhead
- Experimental for Minecraft
- Needs 16GB+ RAM to show benefits
ShenandoahGC (Low Pause)
Pros:
- Very low pause times
- Good for PvP servers
- Less CPU overhead than ZGC
Cons:
- Requires -XX:+UseShenandoahGC flag
- Not available in all JDK builds
- Less testing with Minecraft
ParallelGC (High Throughput)
Pros:
- Highest throughput
- Best for batch processing
Cons:
- Long pause times (100ms+)
- NOT recommended for Minecraft
Performance Profiles
Balanced (Recommended)
Best all-around performance for most servers. Uses proven flag combinations without extreme tuning.
Low Latency (PvP Servers)
Minimizes garbage collection pause times at the cost of slightly lower throughput. Ideal for competitive PvP where every millisecond counts.
High Throughput (Large Servers)
Maximizes overall performance for servers with high player counts and chunk loading. May have slightly longer GC pauses but better overall TPS.
Minimal (Vanilla Servers)
Basic flags for vanilla servers that don't need heavy optimization. Simple and safe.
Common Mistakes to Avoid
Over-Allocating RAM
Problem: Allocating 32GB when you only need 8GB Impact: Longer garbage collection pauses, worse performance Solution: Start small and increase only if needed
Mixing Flag Presets
Problem: Combining Aikar flags with other presets Impact: Conflicting GC settings, unstable performance Solution: Stick to one preset, don't mix and match
Using Old Java Versions
Problem: Running Minecraft 1.20 on Java 8 Impact: Missing critical performance improvements Solution: Use Java 21 for modern Minecraft versions
Ignoring Server Software
Problem: Using vanilla flags on heavily modded Forge Impact: Insufficient timeout settings, crashes Solution: Adjust flags based on server software (add Forge-specific flags)
Not Testing Changes
Problem: Deploying new flags without testing Impact: Unexpected crashes or performance degradation Solution: Test on a copy of your server first
Modded Server Considerations
Forge Servers
Forge servers need additional considerations:
# Add Forge-specific flags
-Dfml.readTimeout=180
-Dfml.queryResult=confirm
Recommended RAM: 8GB minimum for large modpacks Java Version: Java 17 for compatibility Preset: Aikar Flags with higher RAM allocation
Fabric Servers
Fabric is more lightweight:
Recommended RAM: Same as vanilla + 1-2GB Java Version: Java 21 for best performance Preset: MeowIce Flags work excellently
NeoForge Servers
Similar requirements to Forge:
Recommended RAM: 8GB+ for modpacks Java Version: Java 21 (NeoForge requires it) Preset: Aikar or MeowIce Flags
Server Software Optimizations
Paper/Purpur Servers
Paper and Purpur include built-in optimizations that work well with aggressive JVM tuning:
-Dpaper.playerconnection.keepalive=120
Vanilla Servers
Vanilla benefits from conservative flags since it has no server-side optimizations.
How to Apply JVM Arguments
Step 1: Copy Generated Flags
Use this tool to generate your optimized flags, then copy them from the preview panel.
Step 2: Add to Start Script
Linux/macOS (start.sh):
#!/bin/bash
java [YOUR FLAGS HERE] -jar server.jar nogui
Windows (start.bat):
@echo off
java [YOUR FLAGS HERE] -jar server.jar nogui
pause
Step 3: Verify Placement
Flags must come BEFORE the -jar argument:
Step 4: Test and Monitor
Start your server and monitor performance:
- Check TPS with
/tpsor Spark - Watch for GC pauses in console
- Monitor RAM usage
- Check for crashes or errors
Monitoring and Tuning
Tools for Performance Monitoring
Spark Plugin: Best for in-game profiling
- Download: https://spark.lucko.me/
- Shows CPU usage, TPS, GC stats
- Identifies lag sources
JVM Monitoring:
# Add to flags for detailed GC logging
-Xlog:gc*:file=gc.log:time,level,tags
Timings/Spark Reports: Share performance data with others for optimization help.
Signs You Need to Adjust Flags
Frequent Lag Spikes: Try MeowIce flags or lower GC pause time target Constant High Memory: Reduce RAM allocation or add more heap headroom OutOfMemory Errors: Increase RAM allocation (or reduce view distance) Poor TPS Under Load: Try high-throughput performance profile
Advanced Custom Flags
For advanced users, you can add custom flags to further tune performance:
Large Pages (Linux)
-XX:+UseLargePages
Requires system configuration but can improve performance by 5-10%.
Aggressive Optimizations
-XX:+AggressiveOpts
Enables experimental optimizations (use with caution).
Disable Explicit GC
-XX:+DisableExplicitGC
Already included in Aikar/MeowIce flags. Prevents plugins from forcing GC.
Troubleshooting
Server Won't Start
Error: Unrecognized option
- Check Java version compatibility
- Some flags require Java 17+
- Remove unsupported flags
Error: Could not reserve enough space
- Reduce RAM allocation
- Check system available memory
- Use 64-bit Java
Performance Not Improving
Still Getting Lag Spikes:
- Verify flags are applied correctly (check startup log)
- Profile with Spark to find non-GC lag sources
- Consider reducing view/simulation distance
- Check for poorly optimized plugins
High Memory Usage:
- May be normal - Java uses what you give it
- Check for memory leaks with heap dumps
- Reduce pregenerated chunks
- Lower entity limits
FAQ
Related Tools
Optimize your Minecraft server further with these tools:
- server.properties Generator - Configure all server settings
- Velocity Config Builder - Set up proxy networks
- RAM Calculator - Calculate optimal RAM allocation (coming soon)