Java cache for user classloaders

The i5/OS Java Virtual Machine user classloader cache is a feature that allows the Java Virtual Machine to "remember" classes that have been loaded with user classloaders. This feature improves the startup performance of classes loaded by user class loaders by allowing the JVAPGMs created by user classloaders to be cached for reuse, avoiding JVAPGM creation and bytecode verification during the initial class load. WebSphere components (servlets and JSPs) are loaded by user classloaders and can take advantage of this feature.

For most applications, the default WebSphere setup provides the best solution. You should only consider the techniques described here if you are experiencing performance problems in the following areas:

The user classloader cache improves performance in two ways:

Note in both cases the first time the class is loaded (for example before the cache is primed or after a class is changed), these functions are performed and the load is slower. Once the class is already in the cache, these functions are not performed, so subsequent loads are much quicker. There is no way to prime the cache with classes other than running your application.

Using the User Classloader Cache

To enable the user classloader cache, the Java system property os400.define.class.cache.file must be specified with a valid value. Other Java system properties may be optionally specified. Use the following Java system properties to enable and customize the user classloader cache:

Note that other Java system properties, such as os400.defineClass.optLevel, can be used to customize how JVAPGMs are created in the cache.

To add Java system properties to an application server, perform these steps:

  1. In the WebSphere administrative console click Servers --> Application Servers --> server_name.
  2. In the Additional properties section, click Process Definition.
  3. In the Additional properties section, click Java Virtual machine.
  4. In the Additional properties section, click Custom Properties.
  5. Click New to add a property.

For example, to use the shipped cache JAR with a maximum of 10,000 JVAPGMs that have a maximum life of 1 year, you would add the following:

PropertyValue
os400.define.class.cache.file/QIBM/ProdData/Java400/QDefineClassCache.jar
os400.define.class.cache.hours8760
os400.define.class.cache.maxpgms10000