Memory Configuration
By default, the image declares an initial and maximum Java memory-heap limit of 1 GB. There are several ways to adjust memory settings.Basic Memory Settings
Sets both initial (
Xms) and max (Xmx) memory heap settings of the JVM.Supports formats:- Absolute sizes:
1G,2G,2048M,512M - Percentages:
50%,75%
Independently sets the initial heap size (Xms). Overrides MEMORY for initial size.
Independently sets the max heap size (Xmx). Overrides MEMORY for max size.
- Single Memory Value
- Separate Init and Max
- Percentage-Based
Percentage-Based Memory
Percentage-based heap sizing allows control over heap size relative to container memory limits without absolute values.Percentage based heap sizing uses
-XX:InitialRAMPercentage for INIT_MEMORY and -XX:MaxRAMPercentage for MAX_MEMORY. See this article for details.Automatic JVM Memory Calculation
To let the JVM calculate heap size from the container’s declared memory limit, unsetMEMORY with an empty value:
General JVM Options
Space-delimited, raw JVM arguments passed to the Minecraft Server invocation. For standard JVM options like
-Xmx, -Xms, etc.Space-delimited JVM arguments for
-XX options. The JVM requires -XX options to precede -X options.Comma-separated list of
name=value or name:value pairs for system properties. Shorthand for passing multiple -D arguments.- JVM_OPTS
- Compose List Syntax
- Compose Object Syntax (Recommended)
System Properties Shorthand
Instead of passing multiple-D arguments in JVM_OPTS, use JVM_DD_OPTS:
The colon syntax is provided for management platforms like Plesk that don’t allow
= inside a value.Optimized JVM Flags
Aikar’s Flags
Aikar’s research provides optimal JVM flags for GC tuning, important for servers with many concurrent users. PaperMC also explains what these flags do.Enable Aikar’s optimized GC flags for Minecraft servers.
When
MEMORY is greater than or equal to 12G, the Aikar flags are automatically adjusted according to the article’s recommendations.MeowIce’s Flags
MeowIce’s flags are an updated set based on Aikar’s flags with optimizations for Java 17 and above.Enable MeowIce’s optimized JVM flags (Java 17+)
Enable GraalVM-specific optimizations when using MeowIce flags. Only applies when
USE_MEOWICE_FLAGS=true.Example
Flare Profiling Flags
Flare is a profiling suite built into Pufferfish/Purpur and available as a plugin for other server types.Enable JVM flags required for Flare profiling suite
SIMD Optimization Flags
SIMD (Single Instruction, Multiple Data) operations are supported by Pufferfish and Purpur for performance optimization.Enable support for optimized SIMD operations
Remote JMX Monitoring
Enable remote JMX for profiling with tools like VisualVM or Java Mission Control.Enable remote JMX monitoring
IP/hostname of the Docker host running the container
JMX port to expose
- docker run
- docker compose
OpenJ9 Specific Options
The OpenJ9 image tags include specific optimization variables:Enable optimization for virtualized environments. OpenJ9 images only.
Configure nursery sizes where initial size is 50% of
MAX_MEMORY and max size is 80%. OpenJ9 images only.OpenJ9 Example
Complete Example
compose.yaml
Best Practices
Memory Allocation: Start with 2-4GB for small servers (1-10 players). Increase to 6-8GB for 10-20 players, and 10-16GB for larger servers.
Aikar’s Flags: Recommended for most production servers running Java 11 or higher. Automatically adjusts for servers with 12GB+ memory.
MeowIce’s Flags: Recommended for Java 17+ servers. Provides better performance than Aikar’s flags on modern Java versions.