How to change the Spectrum Webtomcat JVM Memory Allocation

book

Article ID: 194856

calendar_today

Updated On:

Products

CA Spectrum

Issue/Introduction

This article will outline how to increase the Spectrum Webtomcat JVM Memory Allocation. For every new session that opens in the client, OneClick WebApp takes around 500 MB of server memory so the memory allocation may need to be increased depending on the amount of users logging into the application.

Environment

Release : 10.4.x

Component : Spectrum OneClick

Resolution

In Spectrum 10.4.0, users can achieve this with the following steps:

- Stop the Webtomcat process.

- Open the <SPECROOT>/webtomcat/bin/catalina.sh file and search for the following section:

# Get standard Java environment variables
if $os400; then
  # -r will Only work on the os400 if the files are:
  # 1. owned by the user
  # 2. owned by the PRIMARY group of the user
  # this will not work if the user belongs in secondary groups
  . "$CATALINA_HOME"/bin/setclasspath.sh
else
  if [ -r "$CATALINA_HOME"/bin/setclasspath.sh ]; then
    . "$CATALINA_HOME"/bin/setclasspath.sh
  else
    echo "Cannot find $CATALINA_HOME/bin/setclasspath.sh"
    echo "This file is needed to run this program"
    exit 1
  fi
fi

 

Under the above section, you will need to add the following lines:

 

JAVA_ENDORSED_DIRS=$CATALINA_HOME/lib/endorsed

# This needs to be done after setclasspath.sh as it sets the JAVA_OPTS as well
JAVA_OPTS="-DOneClick -server -Xmx4096M -XX:+HeapDumpOnOutOfMemoryError -Djava.awt.headless=true -Djavax.net.ssl.trustStore=$SPECROOT/custom/keystore/cacerts -Dfile.encoding="UTF-8" -Dcom.sun.management.jmxremote -Dorg.apache.coyote.USE_CUSTOM_STATUS_MSG_IN_HEADER=true"

 

The -Xmx variable is the amount of memory you would like to allocate in MB. In the example above, this instance would be set to 4GB.

- Once added, you will simply need to save the file and restart the webtomcat process for the changes to take effect.

 

This JAVA_OPTS line will be available out of the box starting in Spectrum 10.4.1 and going forward. Users will just need to adjust the -Xmx parameter if desired.