Shared class cache
Using a Java™ shared class cache provides a means of improving JVM startup time, reducing overall storage usage, and optimizing the compilation process. A class cache can be used with all JVM servers (OSGi, Liberty, and classpath-based).
The IBM®® SDK, Java Technology Edition on z/OS®® supports a shared class cache. To enable a JVM server to use the class cache, and set the size, you must use JVM command line parameters. Other operational requirements, such as monitoring usage of the class cache and destroying class caches, are also performed using options on the Java command.
For more information about Java class data sharing, see Class data sharing.
A shared class cache can contain the following elements:
- Java classes, including application classes, JVM server infrastructure, and Java bootstrap classes.
- Ahead-of-time (AOT) compiled code.
Enabling the class cache
To enable class cache, use a JVM command line parameter, for example:
-Xshareclasses:name=cics.<group>Where <group> might be the JVM profile symbol &applid; if you want to share classes
within the same region only. Alternatively, you can select an arbitrary identifier that all JVM servers of a particular type would connect to, with common classes. The granularity of sharing is user-specific depending on your needs, the size of the class
cache, and the number of shared applications. You can ensure a number of JVM servers of common functions share a class cache name, and that the size of the class cache is large enough to accommodate all uses.Checking the class cache
You can check how full the class cache is by running the z/OS
UNIX command
JAVA_HOME/bin/java
-Xshareclasses:name=<named_cache>,printStats. This query returns a Cache is
nn% full message. Important: If your cache was created using a different
For more information, see Dealing with cache problems.compressedRefs setting than that currently in effect within the JVM, you will
receive a message indicating you should use the correct JVM level. In such situations, you should
check that the compressedRefs settings in effect when you created your cache, are
the same as those in effect when your JVM was created.Setting or changing the class cache size
- Modify the JVM profile to define the named cache size
-Xscmx256M - Shutdown all JVM servers using the cache.
- Remove the cache using
JAVA_HOME/bin/java -Xshareclasses:name=<named_cache>,destroy - Start the JVM servers.