System Zing Memory
The Azul Zulu Prime Builds of OpenJDK (Azul Zulu Prime JVM) instance reserves System Zing Memory as the memory for the Java heap. In addition, System Zing Memory provides resiliency in the event of out-of-memory conditions that can occur when a Azul Zulu Prime JVM instance running a Java application temporarily requires more memory than it was initially allocated. An example of this requirement might occur when a Java application’s workload spikes in an enterprise environment. The System Zing Memory is divided into three memory types:
Reservable memory - The memory for each Azul Zulu Prime JVM instance’s Continuously Concurrent Compacting Collector’s Java heap
Pause Prevention memory
Contingency memory and Pause Prevention memory are each configured to use a percentage of the total System Zing Memory.
The total amount of System Zing Memory is the amount assigned during Azul Zulu Prime System Tools (ZST) configuration using the system-config-zing-memory command and the reserve-at-config policy. The amount of memory to reserve can be done in one of two ways:
As a percentage of the total system memory. The default is 75%.
As a specific amount of memory in MB, where the value is the sum of the Java heap sizes for the Java instances you expect to run plus any additional Contingency and Pause Prevention memory you would like to allocate.
For other types of JVMs, when object allocation rates suddenly increase, the garbage collector can have a difficult time keeping up with the increased rate of object creation. The result is that other JVMs need to pause all work in the process to do a garbage collection. This causes Java application pauses. A common work-around to minimize the length of garbage collection pauses is to specify a small Java heap size – the theory being that a smaller Java heap requires less time to collect. Unfortunately, when the rate of work goes up, more live objects are in the heap when the heap fills up and the amount of time required for the garbage collection is proportional to the number of live objects in the Java heap. The pauses are still long.
As part of the configuration of System Zing Memory, the
system-config-zing-memory tool sets aside a percentage of the System Zing Memory for Pause Prevention memory. When there is a sudden increase in the object allocation rate, the Azul Zulu Prime JVM instance can use the Pause Prevention memory to efficiently keep up with and sustain the throughput during the heavy, unexpected workloads. Using memory from Pause Prevention memory gives the Azul Zulu Prime JVM instance’s Continuously Concurrent Compacting Collector additional time to adjust to and keep up with suddenly increased allocation rates. This ensures that the garbage collector does not stop or pause a Azul Zulu Prime JVM instance running a Java application.
Having Pause Prevention memory ensures that:
The Azul Zulu Prime JVM delivers consistent response times even under sudden high loads.
The Azul Zulu Prime JVM eliminates garbage collection pauses.
|Pause Prevention memory is used seamlessly by the Azul Zulu Prime JVM runtime and Continuously Concurrent Compacting Collector algorithm. There are no settings you need to change or adjust. Using Pause Prevention memory is not a warning or error condition, and is not reported to or visible to you or the application.
The percentages used in the following example are based on the default values used by the
system-config-zing-memory tool. The key relationship to remember is that the amount of Reservable memory in the system must always be greater than or equal to the sum of the
–Xmx values of all concurrently running Azul Zulu Prime JVMs on the system.
The maximum reservable amount of memory can be found using:
reserve-at-config: ReservableMemory = Reservable_Total - Reservable_Used
We need to calculate the amount of memory available for System Zing Memory.
We start by calculating the amount of System Linux memory left after the System Zing Memory configuration:
SystemLinuxMemory_InitiallyConfigured = HostSystemMemory_Total - Reservable_UpperLimit
Find out if the system is using more System Linux memory than initially configured (positive if use is above):
SystemLinuxMemory_Used - SystemLinuxMemory_InitiallyConfigured
Calculate the ReservableMemory
if (SystemLinuxMemory_UseAboveInitiallyConfigrued <= 0)
ReservableMemory = Reservable_UpperLimit - Reservable_Used
We have less memory available than the value of Reservable_UpperLimit
ReservableMemory = (Reservable_UpperLimit -
The difference between the two formulas arises because the total reservable is fixed and pre-reserved when the reserve-at-config policy is used while there is an upper limit, but no pre-reserved memory, for System Zing Memory when reserve-at-launch policy is used. If using the reserve-at-launch policy, the Host System memory may not be available to use as System Zing Memory because it is already in use as System Linux memory.
When estimating the amount of System Zing Memory to allocate, conscider:
System Zing Memory = Reservable memory Contingency memory Pause Prevention memory
Reservable memory = System Zing Memory – (Contingency memory Pause Prevention memory)
|All this memory can be used by a single Azul Zulu Prime JVM instance or multiple Azul Zulu Prime JVM instances.
Maximum Azul Zulu Prime JVM instance heap memory (
-Xmx) = System Zing Memory reserved for the Azul Zulu Prime JVM process use.
Unused Reservable memory = Reservable memory – Sum of Java VM Java Heap memory (
-Xmx) values for all currently running Azul Zulu Prime JVM instances
Generally, to estimate the total amount of System Zing Memory needed, for each Azul Zulu Prime JVM instance that will be running concurrently, add the amount of Java heap memory (
-Xmx) required; then add the memory required for Pause Prevention and Contingency memory (together, these are 10% of total System Zing Memory).
If you typically run 5 Azul Zulu Prime JVM instances and each will reserve 20 GB of memory using the
–Xmx command line option then you need a minimum of 111 GB of System Zing Memory. 100 GB is used by all the Azul Zulu Prime JVM instances and 11 GB is used for the Pause Prevention and Contingency memory.
The following is an approximate breakdown of how the system’s memory is used when there is a single Azul Zulu Prime JVM instance running.
100% Host System memory is shared between:
25% System Linux memory
75% System Zing Memory
100% of System Zing Memory is shared between:
5% Pause Prevention memory for Continuously Concurrent Compacting Collector
5% Contingency memory
90% Reservable for Azul Zulu Prime JVM instances which is shared between:
The reserved –Xmx amount of Reservable memory for each Java heap in each Azul Zulu Prime JVM instance running
For example, if total host system memory is 100 GB:
25 GB is allocated to System Linux memory
75 GB is allocated to System Zing Memory
7.5 GB (10%) is allocated to Pause Prevention and Contingency memory
3.75 GB for Pause Prevention memory
3.75 GB for Contingency memory
67.5 GB is available as Reservable memory
Every Azul Zulu Prime JVM instance running a Java application reserves memory from Reservable memory based on the value of the
-Xmx command line option.