Tune Java virtual machines

Tune Java virtual machines

The application server, being a Java process, requires a Java virtual machine (JVM) to run, and to support the Java applications running on the application server.

About this task

As part of configuring an application server, you can fine-tune settings that enhance system use of the JVM. For more information about JVM settings, see Java virtual machine settings.

A JVM provides the runtime execution environment for Java based applications. WebSphere Application Server is a combination of a JVM runtime environment and a Java based server runtime. It can run on JVMs from different JVM providers. To determine the
JVM provider on which your Application Server is running, issue the java -fullversion command from within your WebSphere Application Server install_root/java/bin directory. You can also check the SystemOut.log from one of your servers. When an application server starts, Websphere Application Server writes information about the JVM, including the JVM provider information, into this log file. Even though JVM tuning is dependent on the JVM provider general tuning concepts apply to all JVMs. These general concepts include:

You can adjust the following settings to change how the system uses the JVM. The following steps do not have to be performed in any specific order.

Procedure

  1. Change the value of the Initial heap size setting

    The Initial heap size setting specifies, in megabytes, how often garbage collection runs, and can have a significant effect on performance. For more information, see the topic Tuning Garbage Collection for Java and and WebSphere on iSeries in the i5/OS Information Center.

    1. In the administrative console, click Servers > Application Servers > server.

    2. Under Server Infrastructure, click Java and Process Management > Process Definition > Java Virtual Machine.

    3. Specify a value in the Initial Heap Size field.

    4. Click Apply or OK.

    5. Save changes to the master configuration.

    6. Stop and restart the application server.

    Default: 96 MB
    Recommended: 96MB per processor

  2. Change the value of the Maximum heap size setting

    The Maximum heap size setting specifies how often garbage collection runs. This setting can have a significant effect on performance. For more information, see the topic Tuning Garbage Collection for Java and and WebSphere on iSeries in the i5/OS Information Center.

    1. In the administrative console, click Servers > Application Servers > server.

    2. Under Server Infrastructure, click Java and Process Management > Process Definition > Java Virtual Machine.

    3. Specify a value in the Maximum Heap Size field.

    4. Click Apply or OK.

    5. Save changes to the master configuration.

    6. Stop and restart the application server.

    Default: 0, which indicates that there is no maximum value.
    Recommended: IBM recommends that you do not change the maximum heap size. When the maximum heap size triggers a garbage collection cycle, the i5/OS JVM's garbage collection stops operating asynchronously. When this happens, the
    application server cannot process user threads until the garbage collection cycle ends, which significantly lowers performance.

  3. Change the setting for the Just-In-Time (JIT) compiler

    A Just-In-Time (JIT) compiler is a platform-specific compiler that generates machine instructions for each method as needed. For more information, see the sections Using the Just-In-Time compiler and Just-In-Time compiler in the i5/OS Information Center topic IBM Developer Kit for Java.

    1. In the administrative console, click Servers > Application Servers > server.

    2. Under Server Infrastructure, click Java and Process Management > Process Definition > Java Virtual Machine.

    3. Select the Disable JIT option if you want to disable the JIT.

    4. Enter -Djava.compiler=jitc in the Generic
      JVM arguments field if you want to run with the full JIT compiler.

    5. Click Apply or OK.

    6. Save changes to the master configuration.

    7. Stop and restart the application server.

    Default: JIT is enabled.
    Recommended: IBM recommends that you do not disable the JIT compiler, and you enable the full JIT compiler (see below). The os400.jit.mmi.threshold can have a significant effect on performance. For more information about the JIT compiler and the os400.jit.mmi.threshold property, see the section Just-In-Time compiler in the i5/OS Information Center topic IBM Developer Kit for Java.

  4. Change the setting for class garbage collection

    The class garbage collection argument, -Xnoclassgc, disables class garbage collection so that your applications can reuse classes more easily. You can monitor garbage collection using the -verbosegc configuration setting because its output includes class garbage collection statistics.

    To view or set this argument

    1. In the administrative console, click Servers > Application Servers > server.

    2. Under Server Infrastructure, click Java and Process Management > Process Definition > Java Virtual Machine.

    3. Enter -Xnoclassgc in the Generic JVM arguments field.

    4. Click Apply or OK.

    5. Save changes to the master configuration.

    6. Stop and restart the application server.

    Default: Class garbage collection is enabled.
    Recommended: Do not disable class garbage collection.

What to do next

See Java memory tuning tips for additional tuning information.

If your application experiences slow response times at startup or first touch, you might want to use the Java user classloader cache. For more information, see Java cache for user classloaders .


 

Related tasks


Tuning the application serving environment

Searchable topic ID: tprf_tunejvm