Procedure to increase Tomcat memory for Service Desk R11.2.

Document ID : KB000055377
Last Modified Date : 14/02/2018
Show Technical Document Details

Procedure to increase Tomcat memory for Service Desk R11.2

By default CA Service Desk starts its instance of Tomcat with a memory pool of 512M in size.

To change this follow the method below, which will enable a permanent change within a Service Desk/CMDB environment.

The example shown allows you to increase the Tomcat Memory to 1024M.

This procedure is suitable for both Windows and UNIX type platforms.

Preparations

Ideally, follow these steps on your test system first for familiarity and a better chance of success.

Check that your system can handle the increase usage of memory that is being recommended.

Make a backup of every file that you have modified. This will allow for a back out recovery.

You can also check if the Java Virtual Machine (JVM) that Tomcat is tied too can handle the increase in memory by using this command at the OS prompt:

 Java -Xmx<value>|more
 where <value> is the memory value. e.g. Java -Xmx1024M|more

Method
The default memory value is specified within Service Desk pdm_tomcat startup parameter list seen within Service Desk stdlog file.

The default parameter in question is -Xmx512M. Service Desk stdlog logs are located under $NX_ROOT/log directory.

Steps for Windows
Step 1 - Add the following @NX_TOMCAT_CMD variable to the end of $NX_ROOT\pdmconf\NX.env_nt.tpl file with new memory value within the -Xmx parameter:

This is just an example of what to add. Please note, do not copy this example to use on your installation:

@NX_TOMCAT_CMD="D:/PROGRA~1/CA/Shared~1/JRE/1.4.2_06/bin/javaw -Djava.net.preferIPv4Stack=true
 -Xrs -Xmx1024M 
-Djaas.config=D:/PROGRA~1/CA/SERVIC~1/add-ons/caflow/jaas.config 
-Djava.security.auth.login.config=D:/PROGRA~1/CA/SERVIC~1/add-ons/caflow/jaas.config 
-Djdbc.baseDriver=com.microsoft.sqlserver.jdbc.SQLServerDriver -Dsun.io.useCanonCaches=false
-Djava.awt.headless=true 
-Djava.endorsed.dirs=D:/PROGRA~1/CA/Shared~1/tomcat/4.1.31/common/endorsed -classpath 
D:/PROGRA~1/CA/Shared~1/tomcat/4.1.31/common/lib/tools.jar;D:/PROGRA~1/CA/Shared~1/JRE
/1.4.2_06/java/lib/tools.jar;
D:/PROGRA~1/CA/SERVIC~1/java/lib/tools.jar;D:/PROGRA~1/CA/Shared~1/tomcat/4.1.31/bin
/bootstrap.jar;D:/PROGRA~1/CA/SERVIC~1/java/lib/sqljdbc.jar 
-Dcatalina.base=D:/PROGRA~1/CA/SERVIC~1/bopcfg/www/CATALINA_BASE -Dcatalina.home
=D:/PROGRA~1/CA/Shared~1/tomcat/4.1.31 
-Djava.io.tmpdir=D:/PROGRA~1/CA/SERVIC~1/bopcfg/www/CATALINA_BASE/temp
 org.apache.catalina.startup.Bootstrap"

Make sure you hit <ENTER> at the end.

If you look closely to the example, it will display three main attributes that you will need to implement:

The usage of forward slashes (Unix style) instead of the back slashes.

The usage of Eight Character Path names instead of the Windows Long File Names.

Removal of double quotes as Long File Names are not used. Double quotes are only specified at the beginning and end of the large string.

The big line above after @NX_TOMCAT_CMD= needs to be coming from the your Service Desk stdlog files of the machine where this is going to be implemented. Hence, please search for "startup_tomcat" within your stdlog file located under $NX_ROOT\log. When you startup Service Desk, you will see a line like the following example from a stdlog file which shows the default value of 512M:

02/06 09:24:11.58 yunle01A pdm_tomcat 3304 SIGNIFICANT pdm_tomcat.c 479 startup_tomcat: 
C:\Program Files\CA\SharedComponents\JRE\1.4.2_06\bin\javaw 
-Djava.net.preferIPv4Stack=true -Xrs -Xmx512M -Djaas.config=C:\PROGRA~1\CA\SERVIC~1
\add-ons\caflow\jaas.config 
-Djava.security.auth.login.config=C:\PROGRA~1\CA\SERVIC~1\add-ons\caflow\jaas.config
 -Djdbc.baseDriver=
com.microsoft.sqlserver.jdbc.SQLServerDriver -Dsun.io.useCanonCaches=false
 -Djava.awt.headless=
true -Djava.endorsed.dirs="C:\Program Files\CA\SharedComponents\tomcat\4.1.31
\common\endorsed" -classpath 
"C:\ProgramFiles\CA\SharedComponents\tomcat\4.1.31\common\lib\tools.jar;
C:\Program Files\CA\SharedComponents\JRE\1.4.2_06\java\lib\tools.jar;C:\PROGRA~1
\CA\SERVIC~1\java\lib\tools.jar;
C:\Program Files\CA\SharedComponents\tomcat\4.1.31\bin\bootstrap.jar;C:\PROGRA~1
\CA\SERVIC~1\java\lib\sqljdbc.jar" 
-Dcatalina.base="C:\PROGRA~1\CA\SERVIC~1\bopcfg\www\CATALINA_BASE" -Dcatalina.home=
"C:\Program Files\CA\SharedComponents\tomcat\4.1.31" -Djava.io.tmpdir="C:\PROGRA~1
\CA\SERVIC~1\bopcfg\www\CATALINA_BASE\temp" 
org.apache.catalina.startup.Bootstrap start

Or in simpler terms:
     02/22 15:03:46.80 valre03- pdm_tomcat 3100 SIGNIFICANT pdm_tomcat.c 479 startup_tomcat: <LARGE COMMAND LIKE THE ONE ABOVE>
Is the one you need to use. Also note, that the last word, "start", on the above "large command" is not used.

Please remember to change the stdlog value that you will be specifying with the new @NX_TOMCAT_CMD variable that you will be adding to mimic the three attributes mentioned above.

Step 2 - Edit $NX_ROOT\pdmconf\pdm_startup.i.tpl file. At the end you will see:

command = "$NX_ROOT/bin/pdm_tomcat_nxd -s"
change it to:
command = "$NX_ROOT/bin/pdm_tomcat_nxd -s -C $NX_TOMCAT_CMD"

Step 3 - Run pdm_configure. Your tomcat server's max memory size will now be 1024 MB.

You will likely find that if you need to restart the tomcat server you will have to reboot the system.

The JVM needs to be able to get a contiguous block of memory on startup.

Steps for Unix
Step 1 - Add the following @NX_TOMCAT_CMD variable with the appropriate value, to the end of $NX_ROOT/NX.env and $NX_ROOT/pdmconf/NX.env.tpl files. The details are below.

Make sure that the Service Desk Daemon is running.

Run the following command:

 pdm_tomcat_nxd -h

This will display the command usage as follows:

pdm_tomcat_nxd -h
Usage pdm_tomcat_nxd
 no options defaults to the daemon mode. 
 -h this message
 -s When running as a daemon will start tomcat now.
 -S <server name>
 -c [START | SHUTDOWN | STOP | EXIT]    Command tomcat through tomcat daemon.
 -d [START | SHUTDOWN | STOP | EXIT]    Command tomcat directly.
 -C Provide a new commandline with out start or stop.  Valid for daemon.
 
  example: -C '/opt/CA/SharedComponents/JRE/1.4.2_06/bin/java -Djava.net.preferIPv4Stack=true
  -Xmx512M -XX:+UseAltSigs -Djaas.config=/opt/CAisd/add-ons/caflow/jaas.config
  -Djava.security.auth.login.config=/opt/CAisd/add-ons/caflow/jaas.config
  -Djdbc.baseDriver=ca.edbc.jdbc.EdbcDriver -Djava.awt.headless=true
  -Djava.endorsed.dirs="/opt/CA/SharedComponents/tomcat/4.1.31/common/endorsed"
  -classpath "/opt/CA/SharedComponents/tomcat/4.1.31/common/lib/tools.jar:
  /opt/CA/SharedComponents/JRE/1.4.2_06/java/lib/tools.jar:/opt/CAisd/java/lib/tools.jar:
  /opt/CA/SharedComponents/tomcat/4.1.31/bin/bootstrap.jar:/opt/CA/SharedComponents/IngresEI
  /ingres/lib/edbc.jar" -Dcatalina.base="/opt/CAisd/bopcfg/www/CATALINA_BASE" -Dcatalina.home="
  /opt/CA/SharedComponents/tomcat/4.1.31" -Djava.io.tmpdir="/opt/CAisd/bopcfg/www/CATALINA_BASE/temp"
  org.apache.catalina.startup.Bootstrap'

These variables should be defined: NX_TOMCAT_INSTALL_DIR, NX_JRE_INSTALL_DIR.

CATALINA_BASE will be set to: /opt/CAisd/bopcfg/www/CATALINA_BASE

Check within your stdlog.x located under $NX_ROOT/log directory for "startup_tomcat" during the timeframe of the startup of Service Desk.

This should show the command used to start tomcat.

From the above output, consider the part after "example -C" and create the NX variable as follows:

(Note: Here modify "-Xmx512M" to "-Xmx1024M" and remove "-XX:+UseAltSigs" from the output above)

 @NX_TOMCAT_CMD='/opt/CA/SharedComponents/JRE/1.4.2_06/bin/java
 -Djava.net.preferIPv4Stack=true -Xmx1024M -Djaas.config=/opt/CAisd/add-ons/caflow/jaas.config
 -Djava.security.auth.login.config=/opt/CAisd/add-ons/caflow/jaas.config
 -Djdbc.baseDriver=ca.edbc.jdbc.EdbcDriver -Djava.awt.headless=true
 -Djava.endorsed.dirs="/opt/CA/SharedComponents/tomcat/4.1.31/common/endorsed"
 -classpath "/opt/CA/SharedComponents/tomcat/4.1.31/common/lib/tools.jar:
 /opt/CA/SharedComponents/JRE/1.4.2_06/java/lib/tools.jar:/opt/CAisd/java/lib/tools.jar:
 /opt/CA/SharedComponents/tomcat/4.1.31/bin/bootstrap.jar:/opt/CA/SharedComponents
 /IngresEI/ingres/lib/edbc.jar" -Dcatalina.base="/opt/CAisd/bopcfg/www/CATALINA_BASE"
 -Dcatalina.home="/opt/CA/SharedComponents/tomcat/4.1.31" -Djava.io.tmpdir="
 /opt/CAisd/bopcfg/www/CATALINA_BASE/temp" org.apache.catalina.startup.Bootstrap'

Add this variable at the end of $NX_ROOT/pdmconf/NX.env.tpl, $NX_ROOT/NX.env, and $NX_ROOT\NX.env.last files.
NOTE: Make sure to hit <ENTER> at the end.

Step 2 - Edit the Service Desk pdm_startup.i* files:

Edit the "$NX_ROOT\pdmconf\pdm_startup.i.tpl" and "$NX_ROOT\pdmconf\pdm_startup.i" files.

At the end of these files you will see:

command = "$NX_ROOT/bin/pdm_tomcat_nxd -s"

change it to:

command = "$NX_ROOT/bin/pdm_tomcat_nxd -s -C $NX_TOMCAT_CMD"

Step 3 - Recycle the Service Desk Daemon Service on the primary and secondary servers.

 pdm_halt
 pdm_init

Notes and Post Procedure Steps (Windows and Unix):

The same value for the @NX_TOMCAT_CMD should not be used on both primary and secondary servers.

Please be sure to use the $NX_ROOT/log/stdlog.X files as mentioned above to identify the correct value for the variable.

You will likely find that if you need to restart the tomcat server you will have to reboot the system.

The JVM needs to be able to get a contiguous block of memory on startup.

Validation Checking for Windows and Unix:

Once all of the steps have been completed and Service Desk has been restarted, follow these steps to validate success:

Check within the stdlog.x located under $NX_ROOT/log directory for "startup_tomcat" during the timeframe of the current startup of Service Desk after all the changes were done.
Within the stdlog line where "startup_tomcat" is specified, you should see -Xmx1024M containing the new value of 1024M that the above example used. If you do not see this, then an editing problem has occurred. Please revisit the steps and try again.

Make sure you can log onto the Service Desk Web Interface via the Tomcat URL successfully.

For Example: http://<serverName>:<Tomcat Port>/CAisd/pdmweb.exe

If you are using CA Workflow, make sure you can log onto CA Workflow from the Service Desk primary machine successfully and that no "cannot connect to PM" error occurs.

If you have received "cannot connect to PM" error, then this means that Tomcat did not start successfully.

This is likely due to an editing problem from the above steps. Please revisit the steps and try again.

Recovery

If there are still problems even after revisiting the steps and multiple attempts, replace all the edited files with the backups made earlier and rerun pdm_configure to recover to the pre-existing state.