WP102766 – WebSphere Application Server z/OS Shared Class Cache
Introduction
When a Java Virtual Machine (JVM) first starts up, Java class files have to be read in and
processed into JVM internal class representations. These internal representations can then be
referenced by Java code executing within the JVM. Once created, the read-only elements of the
object can be stored in shared class cache and referenced from there. The overhead of this activity
typically occurs during JVM and application startup in what’s often referred to as a “warm up”
1
.
Imagine the ability to store the created class representations in memory so the next time the JVM
starts the startup time can be reduced. Imagine further the ability to have multiple JVMs access the
same in-memory cache, allowing faster startup for all JVMs sharing that cache. That's what's
behind the "shared class cache" function of the IBM SDK for Java on z/OS
2
. That function came in
back in IBM JDK 5, which was almost 10 years ago.
For WebSphere Application Server, the ability to share JVM class cache between regions can take
several forms:
• For WAS traditional z/OS -- you can share class cache between multiple servant regions, or
between servant regions and adjunct regions. You can share between multiple control
regions as well, but you can't share between control regions and servant/adjunct regions
3
.
• For Liberty z/OS -- you can share class cache between multiple instances of Liberty.
Basic concepts
• Shared class cache (SCC) is created using the JVM option -Xshareclasses.
• Every shared class cache has a name associated with it. You can take the default name,
which is sharedcc_%u (where %u is the current user name), or you can specify a name, for
example:
-Xshareclasses:name=myCache
Other JVMs can be directed to use that shared class by coding the same JVM option.
• The default location for shared class cache meta-data is under the
/tmp/javasharedresources directory, but you can change that with either a
controlDir= suboption
4
, for example:
-Xshareclasses:name=myCache,controlDir=/myCachePath/
• For WebSphere Application Server z/OS traditional, you can code the JVM option by
manually editing the jvm.options for the server, or by updating the option field for the
server process in the Admin Console. For Liberty z/OS, you code the JVM option by
creating and editing a jvm.options file in the same directory where server.xml resides.
In either case, the server must be restarted for the JVM option to take effect and the shared
class cache to be created.
• The shared class cache lives beyond the life of the JVM. If you stop your JVM and restart it,
the previous shared class cache is still available and ready to use.
You can explicitly delete the cache
5
. An IPL of your system will delete any defined shared
class caches
6
. Do not IPL just to clear the cache; using the explicit delete method.
See "Operational Details" on page 10 for more on how to use shared class cache.
1 This is why controlled benchmark tests often involve a period of activity before the formal measuring takes place. That's to insure the
measured results are after the classes are created and loaded.
2 Shared class cache is a function of the IBM JDK on multiple platforms, not just z/OS. The focus of this document is z/OS.
3 This is because the control region runs under a separate storage key from servant and adjunct regions.
4 Or cacheDir= statement. That results in the same output as controlDir= statement.
5 See "Destroying an existing shared class cache" on page 13.
6 The -Xshareclasses option has a suboption snapshotCache, which will create a snapshot file of an existing non-persistent shared
cache. The restoreFromSnapshot suboption will restore a new non-persistent shared cache from a snapshot file. See
https://www.ibm.com/support/knowledgecenter/en/SSYKE2_8.0.0/com.ibm.java.vm.80.doc/docs/xshareclasses.html for more on these
suboptions.
© 2018, IBM Corporation
- 4 -
WP102766 at ibm.com/support/techdocs
Version Date: Thursday, September 13, 2018