Chunker icon

Chunker -----

Fast and Efficient Async Minecraft World Pre-Generator




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.

Test Old Version New Version Improvement
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.
----------, Mar 23, 2025

Fixed issue preventing the use of the 1.21.4 version in older server versions like 1.21.1, the 1.21.4 version of the plugin should now work with 1.21+ server versions.
----------, Feb 11, 2025

  • I’ve improved how the plugin schedules chunk generation. Previously, each task started its own timer, causing many timers to run at once and creating high CPU usage.
  • Now, Chunker only runs a single repeating process that handles multiple chunks per cycle, which lowers the initial CPU load when generating large numbers of chunks(there will still be an initial spike but not for as long). This should prevent the runaway increase in CPU usage when scheduling higher than 16 for `parallelTasksMultiplier`.
  • Was able to do 16 `parallelTasksMultiplier` for all worlds on a 9800X3D with some headroom left over.
[​IMG]
[​IMG]
----------, Dec 26, 2024

  • Updated to 1.21.4 API
  • Fixed bug that would prevent new tasks from running with the code claiming a task was already enabled when it was not.
  • Tasks are now removed from the `tasks` map when the pre-generation completes or is disabled, preventing "already enabled/disabled" console errors.
----------, Dec 26, 2024

Yesterday, I accidentally uploaded an experimental version that used a new method, getChunksAtAsync(minX, minZ, maxX, maxZ, ...), recently added to Paper's async chunk API. This method allows chunk loading by area. If you downloaded it, please note that it is still experimental and much harder to calibrate since the parallel_tasks_multiplier has a greater effect when working with larger areas like 8, 16, or 32. These correspond to chunk squares of 64, 256, or even an entire region of 1,024 chunks.

If you have more threads and memory, this method works better than the existing version because it can load a large number of chunks in a single call. However, if you want to try the correct version mentioned in yesterday's update, it has now been uploaded, and the experimental version has been removed.

If you still want to try the experimental version, that's fine! Please let me know if you run into any issues and submit them on the GitHub issue page here: Issues · DavidS-Repo/chunker
----------, Nov 26, 2024

  • Fixed a bug were enabling `autorun` caused the `parallel_tasks_multiplier` to be ignored, always setting an equal number of tasks across all threads.
  • Updated chunker to improve performance and memory efficiency, resulting in a ~5-7% uplift in performance, with chunk processing increasing from 198-200 to 208-215 chunks per second.
[​IMG]
----------, Nov 26, 2024

New:
  • Can now run multiple generation task at the same time, all with their own settings.
[​IMG]
  • New print to tell you how long tasks took to complete.
[​IMG]
  • Added settings.yml that includes more in-depth settings as well as the option to run task automatically when there are no players in the server, tasks are terminated when any players connect.
Code (YAML):
# Configuration

# auto_run: Set to true if you want pre-generation to start automatically when no players are on the server.
# Acceptable values: true or false

# task_queue_timer: Determines how fast chunks are queued up. A value between 50-70 is recommended for modern AMD 5000 series and Intel 13th Gen CPUs in the Overworld,
# Adjust based on performance needs.

# parallel_tasks_multiplier: Sets the number of async tasks running concurrently. 'auto' will distribute the tasks based on your thread count.
# You can also set a specific integer value (e.g., 2, 4). It's recommended to stay below your total thread count.
# Example with 'auto' and 12 threads:
# world:
#   parallel_tasks_multiplier: 4
# world_nether:
#   parallel_tasks_multiplier: 4
# world_the_end:
#   parallel_tasks_multiplier: 4

# print_update_delay: How often to print information (s-Seconds, m-Minutes, h-Hours). Default is 5s (5 seconds).

# radius: Defines how far the pre-generator should run (b-Blocks, c-Chunks, r-Regions) or 'default' to pre-generate until the world border.

# Settings
world
:
  auto_run
: false # Acceptable values: true or false
  task_queue_timer
: 60 # Acceptable range: positive integer
  parallel_tasks_multiplier
: auto # 'auto' or a positive integer value
  print_update_delay
: 5s # Format: [value][s|m|h]. Example: 5s, 2h, 1d
  radius
: default # Format: [value][b|c|r]. Example: 100b, 1c, 10r, or 'default'

world_nether
:
  auto_run
: false
  task_queue_timer
: 60
  parallel_tasks_multiplier
: auto
  print_update_delay
: 5s
  radius
: default

world_the_end
:
  auto_run
: false
  task_queue_timer
: 60
  parallel_tasks_multiplier
: auto
  print_update_delay
: 5s
  radius
: default
Changes:
  • /pregenoff has been updated to allow you to shut of a specific generation tasks per world by using /pregenoff [world], the default behavior for /pregenoff with no arguments will shut down all pre-generation tasks.
  • Parallel task multiplier increases load more linearly allowing for better control of the load each task puts on the server. Meaning you won't have to push Parallel task multiplier past your thread count anymore.
  • Moved away from using PaperLib implementation and are instead using papers methods directly, this improved performance slightly for paper server forks.
  • Improved printing for bukkit/spigot as well as performance, default bukkit/spigot behavior with PaperLib was quite slow, only loading about 20 chunks per seconds. The new custom implementation for pre-generating chunks with bukkit/spigot is about 2-3x faster.
Fixes:
  • Reworked printing to make it more accurate, as well as removed unnecessary/redundant prints that server no use.
----------, Aug 12, 2024

Change Log:
  • Changed chunk unload threshold of Chunk.LoadLevel to TICKING instead ENTITY_TICKING, this improves performance by ~ 3 to 8%
----------, Jul 21, 2024

Old Approach:
  • Utilizes the BukkitScheduler to run chunk unload tasks.
  • Tasks are scheduled within the game loop, which introduces some overhead and can limit concurrency.
  • Uses a scheduler to repeatedly check and unload chunks.
New Approach:
  • Uses virtual threads to handle chunk unload tasks.
  • Virtual threads are lightweight, allowing for many more concurrent tasks without significant performance penalties.
  • Runs tasks asynchronously, removing the dependency on the game loop scheduler.
Why the New Approach is Better:
  • The new approach using virtual threads offers lightweight concurrency and reduced overhead compared to the old scheduler-based method, simplifying the code and improving scalability for handling chunk unloading in Minecraft.
----------, Jul 14, 2024

Resource Information
Author:
----------
Total Downloads: 1,653
First Release: Jul 2, 2024
Last Update: Mar 23, 2025
Category: ---------------
All-Time Rating:
1 ratings
Find more info at www.davids-repo.dev...
Version -----
Released: --------------------
Downloads: ------
Version Rating:
----------------------
-- ratings