Regionized Multithreading in Folia 1.21.4: Sustaining 20.00 TPS with 128-Chunk Distant Horizons LOD
1. Breaking the Legacy Single-Threaded Main Loop
Traditional Minecraft servers execute entity AI, fluid updates, redstone, and block-entities sequentially inside one Main Server Thread. Once frame tick cost passes 50.0 ms, TPS collapses even when 63 other EPYC hardware threads sit idle — forcing servers to slash render distances to a claustrophobic 6–8 chunks.
2. Lock-Free Spatial World Partitioning
On our Folia 1.21.4 Region Lab in Frankfurt, global mutable chunk lists are replaced by independent spatial Grid Regions separated by unloaded buffer zones:
- Zero Shared Mutable State: dispersed survival towns own disjoint chunk & entity sets and tick concurrently across separate physical Zen 4 cores without lock contention.
- Dynamic Split & Merge:
TickRegionSchedulermerges regions seamlessly when players converge and splits them again when players travel apart. - Server-Assisted LOD Streaming: pre-baked quadtree height/color LODs stream asynchronously to MGClient's bundled Distant Horizons renderer over an off-tick Netty channel.
Bukkit.getScheduler() calls. Every custom integration on client.minegamers.pro schedules tasks strictly on coordinate-bound RegionScheduler or EntityScheduler queues.
3. NUMA & Thread-Pool Pinning on DE-FRA-Blade05
On our Frankfurt AMD EPYC 9554P node, we pin 32 physical cores to regional tick workers, 6 cores to Moonrise/C2ME async chunk I/O, and isolate dedicated cores for Netty epoll:
threaded-regions:
threads: 32
grid-exponent: 4
merge-radius: 2
chunk-system:
io-threads: 2
worker-threads: 6
gen-parallelism: "on"
packet-limiter:
all-packets:
interval: 7.0
max-packet-rate: 600.0
4. Production Telemetry Results
Under 280 concurrent MGClient testers across 64 active regions, our heaviest region averages 9.8 ms MSPT at a locked 20.00 TPS — while players enjoy crisp 128-chunk Distant Horizons vistas at 180+ FPS.