Minecraft.Parallel by design.
An independent Minecraft runtime in Java 25. Three clear ownership domains, asynchronous worlds, and a dedicated region format. Built for concurrency from the ground up.
In development · 1.0-SNAPSHOT
- Runtime and language level
- Java 25
- Target Minecraft version
- 26.3
- Ticks on a dedicated thread
- 20 / s
- GNU General Public License
- GPL
Great worlds start with a clear foundation.
Llama is a Minecraft server runtime that shows how a server has to be built to stay fast and to keep its state safe.
Every architecture decision is written down with its reason in docs/ARCHITECTURE.md. Where the code lags a decision, the document says so.
Your plugin
A jar with llama-plugin.json, loaded from plugins/
llama-api
The plugin-facing API: interfaces, events, the scheduler and the value types a plugin codes against. Package com.llamamc.llamaapi.
llama
The runtime. It implements the API and contains the server, network, world and configuration code. Package com.llamamc.llama.
Pureline 1.4 The code style of the project: linear control flow, explicit intent, small units and clear ownership.
Clear ownership. Parallel work.
Llama divides the game simulation into three domains. Each owns its state and processes changes on its own thread. The domains exchange tasks and snapshots.
-
Input to Tick
Main loopTick
Processes player input and manages players, inventories and world time. It sets the pace of the simulation.
-
Tick → player snapshots
Own threadEntity
Manages mobs and dropped items in the world. The tracker decides which entities each player can see.
-
Tick → block tasks
Own threadBlock
Processes block changes and scheduled updates. Water, lava and the reactions of neighbouring blocks run here.
Worker pools
Workers generate chunks, calculate light, and read or write files. Finished results become available asynchronously.
- Generation
- Light
- Files
Hand over safely. Changes are posted to the domain that owns the data. Other threads read snapshots; the game simulation never waits for file or network operations.
Five rules everything rests on
They come from the thread model in docs/ARCHITECTURE.md. Each rule is a promise the rest of the code relies on.
-
One owner for loaded state
The tick thread owns all loaded world data, the state of players and the plugin callbacks that touch them. Other entities and the tracker belong to the entity domain.
-
Network and plugins change nothing directly
Netty and plugin threads never mutate loaded state. They hand work to the tick thread through the scheduler.
-
CPU workers return immutable results
They compute on their own buffers and return finished values. They never touch a loaded chunk.
-
IO workers write snapshots
They write immutable snapshots and neither read nor change loaded state.
-
The tick never waits
No blocking disk or network call runs on the tick thread.
Built on what Java 25 brings
Llama uses modern JVM features where they solve a problem of the server.
Runtime
Language level, threads and memory management of the JVM.
-
Java 25
Set through
java.versionin the root pom. The build compiles withrelease 25. -
Virtual threads
supplyAsyncruns tasks on virtual threads. Chunk generation and storage use separate worker pools. -
ZGC
A default flag in
scripts/start.sh. The collector works mostly concurrently and keeps pauses short. -
Compact Object Headers
Also a default in
scripts/start.sh. Smaller object headers save heap.
Network and data
Connections, compression and the world generation pipeline.
-
Netty 4.2
Connections and packet codecs. Netty threads never change loaded state.
-
Zstandard
Chunks are stored through
zstd-jni. The writer picks the level per chunk. -
CompletionStage pipeline
Load, generate and write are chained asynchronous steps. Each one names its executor, nothing runs on the common pool by accident.
Tooling
Console and code style.
-
JLine 4
The console reads commands with a line editor and knows
stopandrestart. -
Pureline 1.4
Guard clauses instead of nested branches, small units, rules with fixed IDs.
A chunk on its way to the player.
The connection pulls, the world does not push. Every step from storage to socket has its own thread domain, and nothing on this path blocks an event loop.
Ten steps, six stations
- 01
Position
Runs on Event loop
A position packet arrives. The streamer smooths the movement into a direction of travel, forgets what left the view and withdraws requests for chunks nobody sees any more.
- 02
Request
Runs on Event loop
From its current position the connection asks for the most important missing chunks: the 9 × 9 around the player first, then in the direction of travel, and what lies behind last. A budget of twice the generation threads, shared over the players, keeps the requests between 8 and 128.
- 03
World
Runs on World worker
Every free thread takes the most urgent waiting chunk. Connections take turns, an aging rank keeps old requests from being overtaken for ever, and chunks nobody wants any more drop out before they cost time.
- 04
Encoder
Runs on Encoder thread
The packet is made once from the palette indexes, with light from the nine surrounding chunks, and compressed. A second player who needs the same chunk gets the same byte array from the cache.
- 05
Pacing
Runs on Event loop
The finished frame waits in a queue ordered by rank. The batch flow releases as many chunks as the client reports per tick. At most ten batches may be unacknowledged.
- 06
Sending
Runs on Event loop
The frame encoder puts the length in front, and Netty writes both buffers with one gathering write. A chunk encoded ahead of time is not copied on the way.
What the load tests show
Measured with simulated clients that ran in the same JVM as the server, on a 16-core machine that other builds were using at the same time. Absolute values move by some tens of percent, the factors hold.
-
11.4–13.5×
faster chunk packet encoding
The packet is written from the palette indexes instead of block by block. A 74 KB terrain chunk takes 329 µs instead of 4,432 µs on one thread.
-
17.8×
fewer bytes per terrain chunk
With zlib level 4 a chunk shrinks from 73.0 KB to 4.1 KB at the same chunk rate. A flying player at 200 chunks per second needs 0.8 MB/s instead of 14.6 MB/s.
-
3,979 / s
chunks for sixteen clients
Sixteen clients flew in sixteen directions at 48 blocks per second. Each kept a complete view of 32 chunks. Compressed, 19 MB/s flowed instead of 333 MB/s.
Source: docs/networking.md. The values describe chunk delivery in the load test, not TPS and not player capacity.
Protection against slow and noisy clients
Every limit counts its victims in NetworkStats, and NetworkLimitsTest checks each one on its own.
- 30 s
Idle
A connection that sends nothing this long is closed. A vanilla client answers the keep-alive every 10 s.
- 500 / s
Packet rate
A connection that sends more packets per second is closed.
- 30 s
Write stall
A channel that stays unwritable this long is closed.
- 16 MiB
Write queue
A connection whose write queue passes this is closed.
- 2 MiB
Packet size
A larger packet closes the connection before it is read. Inflated, it may not pass the limit either.
- 1 MiB
Backpressure
Chunk data is written only while the channel is writable. Control packets such as keep-alive always go at once.
Online mode: login and encryption
With online-mode=true every player proves their account to Mojang's session server, and the connection is encrypted. The default stays false so that a test server needs no account.
-
Offer a key
The server sends its public RSA key (1024 bits) and a random challenge.
-
Secret back
The client sends a 16-byte secret and the challenge back, RSA-encrypted. From this packet on every byte is encrypted in both directions with AES/CFB8.
-
Check without waiting
The RSA decryption runs on two login threads, and the question to the session server goes through the asynchronous HTTP client. The event loop never waits.
-
Confirm the account
The session server answers
hasJoined. A failure or no answer within ten seconds disconnects withauthservers_down, a foreign name withunverified_username. -
Check access
Bans, the whitelist and the player limit are checked with the UUID of the account.
-
Finish the login
login_finishedcarries the UUID, name and skin of the account. After that the connection continues as in offline mode.
Every block deserves safe storage.
Chunks live in region files in the Vicuna format, version 4. Each record is its own commit: it names its chunk, carries a sequence number that only grows, and is covered by two checksums.
A region with several records. One of them, outlined, is about to be replaced.
The new version lies in new units. The old one stays untouched and still counts.
force() returns. From now on the new record counts.
The units of the old version are free until a compaction closes the gap.
- Header and directory: 8 KiB, which is 16 units
- Record: 28-byte header, payload, rounded up to whole units
- Free: space of replaced records, until compaction closes it
- New version: just written, valid after
force()
- 8 KiB fixed part: one header block and one directory block
- 512 B allocation unit. A chunk of 1.4 KiB takes 1.5 KiB, not a whole 4 KiB sector.
- 28 B header per record: length, sequence number, checksums, compression
- 2 GiB largest region file, at most 1023 units per chunk
- 1×
force()per write. Overlapping writers share it through a group commit. - Zstd level 3 on rewrite, level 9 for new chunks when it saves a unit
What happens during a write
After a crash
While a region is open, its header says so. When Llama finds that flag on the next open, it does not trust the directory. It reads the file once, sequentially, and takes the intact record with the highest sequence number for every chunk.
The VicunaCrashTest cuts the power at random moments and checks every chunk afterwards. Its disk model lets every unforced 512-byte block arrive or not.
Vicuna V4 versus Mojang's Anvil
An isolated storage benchmark on NVMe with 256 terrain chunks. Both engines write synchronously: Vicuna V4 against Minecraft’s original Anvil implementation with Deflate.
- NVMe Storage: NVMe SSD
- 256 terrain chunks as the workload
- 10 independent runs, each with a freshly started JVM (single writer)
- Sync All write comparisons with synchronization enabled
1 writers
1,073 Vicuna V4
429 Anvil Deflate (Sync)
4 writers
2,238 Vicuna V4
552 Anvil Deflate (Sync)
8 writers
3,930 Vicuna V4
545 Anvil Deflate (Sync)
1 writers
1.36 ms Vicuna V4
3.05 ms Anvil Deflate (Sync)
4 writers
3.03 ms Vicuna V4
9.60 ms Anvil Deflate (Sync)
8 writers
3.28 ms Vicuna V4
18.6 ms Anvil Deflate (Sync)
- Concurrent writers
- A writer is one concurrent stream of write operations. Selecting 1, 4 or 8 changes the number of these streams in the comparison. It does not represent the number of connected players.
- Throughput
- How many chunk updates finish per second in total. Higher is better here. This measures the combined writing work of all writers, rather than the time taken by one individual operation.
- Latency · p50 and p99
- Latency is the time taken by one operation. p50 is the median of a measurement run; p99 is the time within which 99% of its measured operations finish. p99 reveals slow operations, but is not the worst individual value.
From one to eight writers: Vicuna 3.66× the throughput, Anvil 1.27×. Worst observed maximum of Vicuna V4: 10.2 ms at one, 9.2 ms at four and 7.2 ms at eight writers. This measurement series has no maximum values for Anvil, so there is no comparison here.
One writer: latency per operation −60.6% p50
Up to 60.6% lower median chunk update latency (p50) compared to vanilla Anvil.
All bars of a metric share one scale that starts at zero.
Storage footprint after the updates −53%
Approximately 53% smaller region storage for the tested terrain dataset.
All measurements
| Metric | Vicuna V4 | Anvil | Difference |
|---|---|---|---|
| Update p50 | 0.93 ms (0.91 to 0.97) | 2.36 ms (2.27 to 2.51) | −60.6% |
| Update p99 | 1.72 ms (1.12 to 2.52) | 3.38 ms (2.81 to 3.86) | −49.1% |
| Median of run maxima | 6.2 ms | 8.7 ms | −28.7% |
| Worst observed maximum | 8.2 ms | 10.3 ms | −20.4% |
| New chunk p50 | 1.13 ms | 2.3 ms | −50.9% |
| Random read p50 | 0.033 ms | 0.154 ms | −78.6% |
| File size | 499 KB | 1.06 MB | −52.9% |
| Writers | 1 | 4 | 8 |
|---|---|---|---|
| Vicuna V4, chunks/s | 1,073 | 2,238 | 3,930 |
| Anvil, chunks/s | 429 | 552 | 545 |
| Throughput factor | 2.50× | 4.05× | 7.21× |
| Vicuna V4, p99 | 1.36 ms | 3.03 ms | 3.28 ms |
| Anvil, p99 | 3.05 ms | 9.60 ms | 18.6 ms |
| p99 lower | −55.4% | −68.4% | −82.4% |
| Vicuna V4, worst observed maximum | 10.2 ms | 9.2 ms | 7.2 ms |
In parentheses: minimum to maximum across the ten runs.
Putting it in context
- Where the numbers come from Vicuna is a storage engine of our own, not a renamed Anvil. On the single-writer path a commit costs one
fsync. With concurrent writers, a leader batches the commits (group commit). Add Zstandard instead of Deflate and the reuse of free space. - What they do not show These are isolated storage benchmarks. They say nothing about the TPS of a whole server or about player capacity. The measurements alone also do not show that both engines give equivalent guarantees under power loss and crash recovery.
Benchmarks conducted on NVMe storage using 256 generated terrain chunks. Both implementations used synchronous writes. Single-writer latency statistics represent medians across ten independent JVM runs. Performance varies depending on hardware, workload, compression behavior, and concurrency. Results represent isolated storage benchmarks, not full Minecraft server TPS or player-capacity measurements.
The Vicuna file is about 1.9% of the uncompressed data. This high compression ratio depends on the tested terrain and is not automatically representative of inventories, complex block entities or other data-heavy chunks. Not every Minecraft world will shrink by that much.
Three dimensions, checked against the original
The overworld, Nether and End use the same seed as the official 26.3 server. Reference tests compare blocks, biomes and structures. “Exact” means agreement in the documented checks; complete world generation still has known limits.
Overworld
Density, biomes and surface form the foundation. Trees, plants and structures build on top. Each stage is compared separately with the official server before the next is added.
No difference in the documented comparison.
-
Overworld: density and biomes
ExactFinal density matches bit for bit in 40 chunks from 5 seeds. The biome reference checks every 4 × 4 × 4 cell of 50 chunks.
-
Overworld: plants, trees and other features
PartialAll placed features of the overworld biomes are implemented and compared. Post-processing through light and fluids is not yet complete.
Nether
Its own density, lava and material rules shape the Nether. Its structures use the same shared pipeline. Large basalt deltas still show differences where features interact across many neighbouring chunks.
Terrain, surface, caves and biomes with no difference.
-
Nether: terrain and biomes
Exact245 chunks from 5 seeds with all five biomes, surface and caves: no difference. Large basalt delta areas remain a limit of feature generation.
-
Villages, fortresses and other structures
PartialStructures in all three dimensions are generated and checked against the original. Some associated entities, including shulkers and elytra frames, are still missing.
End
The central island and outer islands emerge from the End density. Pillars, chorus plants and end cities follow. Additional tests check that chunks remain the same when generated in a different order and across multiple threads.
No difference in the documented terrain check.
-
End: islands and features
Exact10,440 terrain chunks from 8 seeds compared. Pillars, chorus plants, small islands, gateways and the arrival platform are also checked.
-
Dragon fight and end crystals
OpenThese belong to the running game and are not implemented yet. This also includes the exit portal and the gateways after the dragon fight.
Reference checksums preserve the official server’s results. “Exact” means the tested seeds, chunks and stages agree. “Partial” identifies known gaps. These samples do not guarantee agreement for every possible world.
All checks and measurements Implemented areas, known limits and generation times
| Area | State | Checks and limits |
|---|---|---|
| Overworld: density and biomes | Exact | Final density matches bit for bit in 40 chunks from 5 seeds. The biome reference checks every 4 × 4 × 4 cell of 50 chunks. |
| Aquifers, surface and caves | Exact | 325 chunks for aquifers, 85 for surface and caves. An additional surface scan across 1,445 chunks found no difference. |
| Overworld: plants, trees and other features | Partial | All placed features of the overworld biomes are implemented and compared. Post-processing through light and fluids is not yet complete. |
| Villages, fortresses and other structures | Partial | Structures in all three dimensions are generated and checked against the original. Some associated entities, including shulkers and elytra frames, are still missing. |
| Nether: terrain and biomes | Exact | 245 chunks from 5 seeds with all five biomes, surface and caves: no difference. Large basalt delta areas remain a limit of feature generation. |
| End: islands and features | Exact | 10,440 terrain chunks from 8 seeds compared. Pillars, chorus plants, small islands, gateways and the arrival platform are also checked. |
| Dragon fight and end crystals | Open | These belong to the running game and are not implemented yet. This also includes the exit portal and the gateways after the dragon fight. |
Documented overworld CPU times
- 4.1 ms Llama terrain: density, aquifers, surface and caves
- 13 ms Llama chunk with all features
- 15 ms Official server terrain in the same comparison
Measurements from docs/ARCHITECTURE.md, section 11: approximate times on one thread of the same machine, full chunks in 10 × 10 squares. These do not measure TPS or player capacity.
The server watches itself
Llama adapts the view distance to the load, evicts chunks nobody uses and keeps a fixed deadline for shutting down.
View distance follows the load
Nobody sets it. It starts at 64 chunks and is looked at every five seconds. If any signal is bad, it drops by a quarter at once, never below 4.
After two calm looks in a row it grows by 2, never above 64. Falling fast and growing slowly keeps it from swinging around the limit. A player gets at most what their own client asks for.
| Signal | Overloaded | Calm |
|---|---|---|
| Tick time, 95th percentile of the last minute | above 45 ms | below 30 ms |
| Ticks per second, last 5 seconds | below 19 | at least 19.8 |
| Chunk-load capacity in use | above 50% | below 10% |
| Heap in use | above 85% | below 70% |
The server counts as overloaded as soon as one signal is bad. It counts as calm only when all signals are calm.
How the view distance reacts
A schema of the rule, not a measurement.
- overloaded
- calm
- View distance in chunks
Shutdown in four windows
One deadline of 60 seconds covers everything. The windows are budgets: whoever finishes early hands over to the next stage at once.
- 0–5 s
Connections
No new connections. Players are disconnected, quit events fire.
- 5–15 s
Plugins
Plugins are disabled and their tasks stopped. World state is frozen.
- 15–50 s
Saving
Chunks, players and world data are written, and only then does the storage close.
- 50–60 s
Cleanup
Executors, Netty and the remaining resources are terminated.
At the deadline the runtime halts with a diagnostic dump. A run counts as clean only when every required write has finished.
-
Chunk eviction
A chunk without a ticket is evicted after 90 seconds without access, after 30 under memory pressure (heap above 85%). Each tick examines at most 64 chunks. Dirty chunks are saved first.
-
Watchdog
If a tick hangs, the watchdog dumps the stacks so you can see what it is stuck on.
-
Restart
Exit code 75 asks
scripts/start.shfor a restart, for example after an out-of-memory error or from the watchdog, and writes a crash report. On the fourth restart within 300 seconds the script gives up.
import com.llamamc.llamaapi.ILlama;
import com.llamamc.llamaapi.event.impl.player.PlayerJoinEvent;
import com.llamamc.llamaapi.plugin.IPlugin;
public final class WelcomePlugin implements IPlugin {
public WelcomePlugin(ILlama llama) {
llama.events().on(PlayerJoinEvent.class, event ->
llama.scheduler().runOnTick(() ->
System.out.println("Welcome, " + event.player())));
var world = llama.worlds().mainWorld();
world.chunk(0, 0).whenComplete((chunk, error) -> {
if (error != null) {
System.err.println("Chunk 0,0 failed: " + error.getMessage());
return;
}
llama.scheduler().runOnTick(() -> System.out.println(
"Highest block at 0,0: " + chunk.highestBlockY(0, 0)));
});
}
} Your ideas. A clear API.
A loader of its own reads llama-plugin.json, resolves dependencies as a graph and hands each plugin what it needs through its constructor. There is no DI framework and no classpath scanning.
The chunk callback can run on a worker or directly on the calling thread. runOnTick schedules the following work on the tick thread.
{
"id": "economy",
"name": "Economy",
"version": "2.1.0",
"main": "com.example.EconomyPlugin",
"depends": ["permissions"],
"softDepends": ["chat"]
} id, name, version and main are required. depends and softDepends are optional lists of plugin ids.
From jar to running plugin
-
Resolve
Before anything loads, the loader orders all plugins as a graph. A cycle or a missing hard dependency disables the affected plugins, and the server still starts.
-
Constructor
Each plugin is created after its dependencies. The constructor parameters are the services it needs.
-
load() and enable()load()andenable()follow. If either throws, only that plugin is disabled and logged. -
disable()At shutdown, in reverse load order. The plugin's commands and handlers disappear and its class loader is closed.
- One class loader per jar Its parent is the server class loader. The plugin shares the API classes and cannot replace them.
- Dependencies as a graph Topological sort over
dependsandsoftDepends. A cycle disables every plugin in it. - Failures stay local A failing plugin is disabled and logged. The server start goes on.
- Injectable types
IScheduler,IEventBus,ICommandRegistry,IPermissionService,ILlama,IPluginContextandLogger. - Services between plugins A plugin publishes a service through
IPluginContext.provide. A plugin with a hard dependency on it receives it through its constructor.
The current state of development
Llama is 1.0-SNAPSHOT and under active development. The runtime already includes world generation and gameplay; its API and feature set continue to evolve. The documentation records checks and known limits.
Implemented8
- Online mode with account verification, encrypted connections and profile skins;
online-mode=falseremains the default - Event bus, scheduler, registries, configuration and commands
- Plugin loader with dependency resolution and permissions
- Asynchronous chunk processing, Vicuna storage, tickets and eviction
- Overworld, Nether and End with features and structures
- Block breaking and placement, containers, flowing water and lava, and falling blocks
- Player and entity persistence; zombie, cow, pig, sheep and chicken with spawning
- Adaptive view distance, watchdog, crash reports and a bounded shutdown
Known limits8
- Signed chat is missing; player messages are sent as system messages.
- Network interceptors and listeners exist as API types but are not connected to the runtime.
- Plugins cannot yet be reloaded while the server is running.
-
join()does not check whether it is called on the tick thread. - Closing the scheduler cancels or fails queued tasks.
- World generation: known differences in basalt deltas, unfinished post-processing and missing structure entities.
- Crafting tables, furnaces and further block interactions are not implemented yet.
- The
formatfield inworlds.tomlis not evaluated yet. Chunks are always stored in the Vicuna format.
Build and run
Llama needs Java 25. In the repository root, Maven tests and builds the jar, then scripts/start.sh starts the server. Llama creates any missing configuration file in the working directory on start.
-
Provide Java 25
The project sets
java.versionto 25. Maven and the runtime need a matching JDK. -
Test
mvn -B testruns the tests from the root directory of the repository. -
Build
mvn -B packageproduces the server asllama/target/llama.jar. -
Start
scripts/start.shstarts the server and starts it again as long as it exits with code 75. Llama creates missing configuration files on the way.
mvn -B test
mvn -B package
LLAMA_JAR="$PWD/llama/target/llama.jar" scripts/start.sh The script changes into its own directory first, which is why the jar path is absolute. worlds/, logs/latest.log and crash-reports/ are created there too.
Environment variables of scripts/start.sh
| Variable | Default | Meaning |
|---|---|---|
| LLAMA_JAR | llama.jar next to the script | Path to the server jar |
| LLAMA_MEMORY | 2G | Heap size for -Xms and -Xmx |
| JAVA | java | The java executable |
| JAVA_FLAGS | -XX:+UseZGC -XX:+UseCompactObjectHeaders | Extra JVM flags |
Exit codes
| Code | Meaning |
|---|---|
| 0 | Normal stop: stop in the console, Ctrl+C, ILlama.shutdown() or JVM shutdown. |
| 1 | Error, including a failed start. |
| 75 | Restart requested: restart in the console, an out-of-memory error or the watchdog. |
Configuration files
| File | Content |
|---|---|
| llama.properties | host (127.0.0.1), port (25565), motd, max-players (10), minecraft-version (26.3) and online-mode. |
| permissions.toml | Groups with permissions under [groups], and per user under [users.<uuid>] permissions and groups. |
| worlds.toml | One [worlds.<name>] table per world with type, dimension and seed. Default: main (NORMAL, OVERWORLD) and building (FLAT, THE_END). |