This version of Chunker brings significant improvements in memory efficiency, GC behavior, and compatibility — especially under high parallel load configurations.
Improvements
- Coordinate Caching
Introduced a lightweight cache for coordinates to reduce frequent object creation and Java GC pressure.
This dramatically reduces heap usage during high-throughput pre-generation.
- Memory Leak Fixes
Resolved an issue where tracked chunks for players were not being cleared correctly, causing memory to grow over time even after chunks were unloaded. This would only happen if players were in the server and running pregen in the background at the same time.
- Smarter Memory Footprint
Optimized several internal variables and data structures to further reduce overall memory usage, especially when running across all 3 dimensions.
- Added Support for Folia
Chunker is now fully compatible with
Folia servers, alongside all existing supported server types.
Benchmark Results – Memory Usage Comparison
Two tests were performed to compare memory usage between the
old and
new versions of Chunker, using the same world seed and identical start points.
parallel_tasks_multiplier = 16 (on all dimensions) |
7.2 GB |
3.3 GB |
−54.2% |
parallel_tasks_multiplier = 200 (on end dimension only) |
26.7 GB (crashed) |
11.3 GB |
−57.7% |
Benchmark Test Setup (Reproducible)
JVM Launch Parameters (start.bat):
Code (Text):
@echo off
java -Xms1G -Xmx30G -XX:+UseG1GC -XX:+UnlockExperimentalVMOptions -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 -XX:+OptimizeStringConcat -XX:+UseCompressedOops -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:+ParallelRefProcEnabled -XX:+UseNUMA -XX:ParallelGCThreads=16 -XX:ConcGCThreads=16 -XX:MaxGCPauseMillis=50 -Dusing.aikars.flags=https://mcflags.emc.gs -Daikars.new.flags=true -jar server.jar --nogui
pause
- Xms1G and Xmx30G should be updated to match your minimum (Xms) and max memory (Xmx) for your own server.
- Update both XX:ParallelGCThreads and XX:ConcGCThreads to match your number of threads.
Paper Configuration (paper-global.yml):
Code (YAML):
chunk-loading-advanced:
auto-config-send-distance
: true
player-max-concurrent-chunk-generates
: -1
player-max-concurrent-chunk-loads
: -1
chunk-loading-basic:
player-max-chunk-generate-rate
: -1.0
player-max-chunk-load-rate
: -1.0
player-max-chunk-send-rate
: -1.0
chunk-system:
gen-parallelism
: default
io-threads
: 16
worker-threads
: 16
region-file-cache-size
: 16
Testing Methodology:
- All world data was reset between tests, except level.dat, to keep the same world seed.
- Chunker plugin data was wiped to start fresh from (0, 0) in each test.
- Each test was run for 1 hour (parallel_tasks_multiplier = 16) and 15 minutes (parallel_tasks_multiplier = 200), allowing memory to stabilize.
- Console print statements may still cause slight memory increases due to terminal buffer growth.
Tips for Best Performance
- Use Paper or Folia with chunk-loading limits removed (as shown above).
- Tune parallel_tasks_multiplier and task_queue_timer based on your system’s CPU core count and available memory.
- Use print_update_delay of 10s+ to avoid excessive log output during long runs.
- Lower region-file-cache-size if running pregen on a fresh world with no players online.