Modded Minecraft servers are among the most demanding workloads you can run on a dedicated server. A single modpack like All the Mods 9 or GregTech: New Horizons can require 8-12 GB of RAM just for the server process, and the wrong JVM flags can turn a high-end machine into a laggy mess. This guide covers the specific JVM arguments, RAM allocation strategies, and tick-rate tuning that keep a modded server stable at 20 TPS (ticks per second) with 30-80 players online.
Why Modded Minecraft Is Different from Vanilla
Vanilla Minecraft servers run on a single thread and fit comfortably in 1-2 GB of RAM for 20 players. Modded servers add hundreds of custom blocks, mobs, and mechanics — each with its own tick handler, chunk loading, and memory footprint. A 2026 survey of 500 modded server operators showed that the most common cause of TPS drops below 18 is not CPU speed but garbage collection (GC) pauses from improper JVM tuning. The second most common cause is allocating too much RAM, which paradoxically makes GC pauses longer.
RAM Allocation: The Goldilocks Zone
Java’s garbage collector works best when the heap is neither too small (causing frequent, short pauses) nor too large (causing rare but multi-second pauses). The JVM performs worst when you allocate more than 12 GB to a single Minecraft server process, because the default G1GC pauses scale with heap size. For modded servers, the sweet spot depends on the modpack’s complexity:
| Modpack Type | Recommended RAM | Max Players | Notes |
|---|---|---|---|
| Light modpacks (10-30 mods, QoL only) | 4-6 GB | 20-30 | Similar to vanilla, small heap is fine |
| Medium modpacks (30-80 mods, tech + magic) | 6-8 GB | 30-50 | Most common modded server tier |
| Heavy modpacks (80-150 mods, large content) | 8-10 GB | 30-60 | ATM9, FTB, Enigmatica 2 Expert |
| Expert / GregTech packs (150+ mods) | 10-12 GB | 20-40 | Requires aggressive GC tuning |
| Multi-instance server (2+ modpacks) | 4-6 GB per instance | Varies | Separate JVM per instance, total ≤ 80% of physical RAM |
Never allocate more than 50% of your server’s physical RAM to a single Minecraft Java process. The OS, other services, and memory-mapped files need headroom. On a 32 GB server, cap Minecraft at 12 GB; on a 64 GB server, cap at 16 GB unless you run multiple instances.
Essential JVM Arguments for Modded Minecraft
The default JVM flags that ship with a typical Minecraft server script are optimized for nothing. Replace them with these arguments for a modded server:
-Xms8G -Xmx8G
-XX:+UseG1GC -XX:+ParallelRefProcEnabled
-XX:MaxGCPauseMillis=100 -XX:+UnlockExperimentalVMOptions
-XX:G1HeapRegionSize=4M -XX:G1NewSizePercent=30
-XX:G1ReservePercent=20 -XX:SurvivorRatio=32
-XX:MaxTenuringThreshold=1
-XX:+PerfDisableSharedMem -XX:+DisableExplicitGC
-XX:+AlwaysPreTouch -XX:+UseLargePages
-XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4
Flag explanations:
- -Xms / -Xmx: Set the initial and maximum heap to the same value. This prevents the JVM from resizing the heap at runtime, which triggers full GC events.
- G1GC with MaxGCPauseMillis=100: G1 is the best GC for heaps between 4-16 GB. The 100 ms target keeps GC pauses under the 50 ms tick window most of the time.
- G1NewSizePercent=30: Allocates 30% of the heap to new (young) objects. Modded servers create many short-lived objects — this reduces promotion pressure.
- AlwaysPreTouch: Forces the OS to commit physical RAM to the heap at startup, preventing runtime page faults that cause lag spikes.
- UseLargePages: Reduces TLB misses for the heap. Requires HugeTLB or transparent hugepages enabled at the OS level.
- DisableExplicitGC: Prevents mods from triggering System.gc(), which causes full stop-the-world pauses.
CPU and Tick Rate Optimization
Modded Minecraft runs its main tick loop on a single thread. If that thread hits 100% utilization, TPS drops below 20 regardless of other resources. Key optimizations:
- CPU pinning: Use taskset to pin the Minecraft process to a single physical core. Reserve a separate core for OS interrupts and the garbage collector. On a 16-core EPYC, pin Minecraft to cores 0-3 (4 threads) and leave cores 4+ for the OS and other services.
- View distance control: Set view-distance=8 in server.properties as a starting point. Each chunk of view distance adds roughly 2-3 ms of tick time on a 50-player modded server. At view-distance=10 with heavy mods, the tick time can exceed 50 ms, causing visible lag.
- Entity and tile entity limits: Use datapacks or server-side mods to cap mobs per chunk (e.g., 20 mobs per chunk) and tile entities per loaded area. Branch mining caves with 200+ entities in one chunk is a common TPS killer.
- Simulation distance: Set simulation-distance=6 or lower. This controls how many chunks around each player actually process entities and redstone, and it is the single biggest lever for TPS improvement on any modded server.
Monitoring and Diagnostics
You cannot optimize what you cannot measure. Install at least one of these tools on your dedicated server:
- Spark: The gold standard for Minecraft server profiling. Run /spark profiler for 30 seconds to see exactly which methods consume tick time. Plugin tick handlers and entity AI are the most common culprits.
- Observable: A visual profiling tool that graphs heap usage, GC pauses, and TPS on a timeline. Useful for identifying the exact moment a lag spike correlates with a GC event.
- htop / btop: OS-level monitoring. Watch for runaway memory usage or CPU core stealing from other processes on shared hardware.
Run a baseline profile on an empty server (no players) and again with 10, 20, and 50 players. The difference shows you where your bottleneck shifts from CPU to memory to GC. If TPS drops below 18 at 30 players with 8 GB allocated, the issue is rarely "not enough RAM" — it is almost always a mod or entity group that is consuming disproportionate tick time.
Putting It All Together: A Sample Server Command
#!/bin/bash
# Modded Minecraft server launcher for 32 GB dedicated server
java -Xms8G -Xmx8G -XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=100 -XX:+UnlockExperimentalVMOptions -XX:G1HeapRegionSize=4M -XX:G1NewSizePercent=30 -XX:G1ReservePercent=20 -XX:SurvivorRatio=32 -XX:MaxTenuringThreshold=1 -XX:+PerfDisableSharedMem -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:+UseLargePages -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -jar server.jar nogui
This configuration assumes you have a dedicated server with at least 16 GB of physical RAM, NVMe storage, and a CPU with a Geekbench 6 single-core score of 2,000+. If you are shopping for hardware to run a modded Minecraft community, compare dedicated server plans for gaming on our comparison page to find a configuration that matches the RAM and CPU requirements above.
Remember: the best JVM tuning in the world cannot fix a server that is oversold on RAM or running on a CPU with single-core performance below 1,800. Start with the right hardware, then apply these flags. Your players will notice the difference before the first chunk loads.


Leave a Reply
You must be logged in to post a comment.