Visit Azul.com Support

Using Compile Stashing

Table of Contents
Need help?
Schedule a consultation with an Azul performance expert.
Contact Us
Looking for Zing?
The Azul Zing Virtual Machine is now Azul Zulu Prime Builds of OpenJDK and part of Azul Platform Prime.
Learn more

Compile Stashing is a Azul Zulu Prime Builds of OpenJDK (Azul Zulu Prime JVM) feature that caches compiles performed in one run and reuses them in subsequent runs.

Compile Stashing used with ReadyNow has mixed results but has been shown to significantly reduce compiler start time and CPU usage in some cases.

Usage Recommendations

It is recommended to use Compile Stashing with ReadyNow for the best results.

Note
Starting with ZVM 19.12.0.0, Compile Stashing is not enabled by default with the ‑XX:ProfileLogOut command-line option. Compile Stashing is still enabled by default only in combination with the ‑XX:ProfileLogIn command-line option.

Use -XX:+FalconUseCompileStashing if you need to turn on Compile Stashing, and -XX:-FalconUseCompileStashing to turn it off. The structure of a disk cache location can change. It is safe to delete an arbitrary file from a directory.

The default configuration when all Azul Zulu Prime JVMs use the same cache is beneficial because the JVMs can reuse each other’s compilations when all JVM instances running on the same machine use the same cache. To avoid the slowdown of the Compile Stashing read, write, and lookup functions, make sure the cache file system is fast (for example, stored locally).

Populating Compile Stashing

To populate the cache, use the -XX:+FalconUseCompileStashing command-line option. You can adjust the cache size using the -XX:FalconMaxCacheSize=<size in number GB> option, where number is how many gigabytes you allocate for your cache.

Compile Stashing writes compiled code to the file system to access it again for the next run of Azul Zulu Prime JVM. By default it writes up to 10 GB of data to the file system at $HOME/.zing/falcon-cache/<zvm_version>/ so you must provide enough free space in $HOME. If the home directory is smaller than 10 GB, use the -XX:FalconObjectCacheRoot=<path> command-line option to change the default location or disable Compile Stashing.

Compile Stashing can work without ReadyNow. However, if both are enabled, the startup time is significantly reduced.

Command-Line Options for Compile Stashing

Use the following command-line options to control caching and enable reporting:

Compile Stashing Command-Line Options

Command-Line Option Description

-XX:+FalconUseCompileStashing

Enables Compile Stashing, populates the cache. Default value: false. Before Azul Platform Prime 19.12.0.0, Compile Stashing was enabled by default if -XX:ProfileLogOut was set.

-XX:FalconObjectCacheRoot=<path>

Sets the cache location. The default value is $HOME/.zing/falcon-cache/<zvm_version>/. By default, different instances of Azul Zulu Prime JVM running on the same host share the same stash location. However, different instances can be configured to use different locations via the FalconObjectCacheRoot option.

-XX:-FalconUseCompileStashing

Disables Compile Stashing, populates the cache.

-XX:+FalconLoadObjectCache

Enables loading from compile cache.

-XX:+FalconSaveObjectCache

Enables saving to compile cache.

-XX:FalconMaxStashedCompileSize=<max_size>

Specifies the maximum size of a stashed compile entry. When running multiple virtual machines concurrently, different cache sizes for different virtual machines are not recommended. Similar cache sizes are advised.

-XX:FalconMaxCacheSize=<max_size>

Specifies the maximum size of the compile cache (10 GB by default).

-XX:-FalconObjectCachePrintReport

Prints stashing statistics.

-XX:-FalconObjectCachePrintPrecompilationReport

Prints stashing report at the end of ReadyNow precompilation.

When printing stashing statistics is enabled, it is included in the cumulative report as shown in the sample below:

 
Stashing Final: Compiles performed: 2204 Estimated compile time win: 0.0s Estimated avg. compile time win: -nans Biggest compile time win: 0.0s Matches attempted: 2204 (100.0%) Reads excluded via compile command: 0 Succeeded to match: 0 (0.0%) Missing in cache: 408 (18.5%) Cache found but did not match: 1796 (81.5%) Added to cache: 0 (0.0%) Writes excluded via compile command: 0 Lookup errors: 0 Write errors: 0