JVM Settings for 3DOrchestrate Distribution Server Configured by TomEE CATALINA Scripts

You can change the JVM memory/performance settings for the 3DOrchestrate Distribution Server.

After installing the 3DOrchestrate Distribution Server, you can configure and deploy the application using the 3DOrchestrate deployment utility (as described in Deploying 3DOrchestrate in the Java Application Server). You provide the appropriate information in each tab of the deployment utility, depending on the target execution environment, and then execute the following Server Actions:

  • Build EAR/WAR files
  • Configure server
  • Deploy application

The resulting configuration files are stored in the following folders/directories:

<server_install_dir>/config/
<server_install_dir>/exe1/tomee/

In particular, the directory

<server_install_dir>/exe1/tomee/bin/

contains three executable scripts (.bat files for Windows, .sh files for Linux):

setenv.[bat|sh]
startup.[bat|sh]
shutdown.[bat|sh]

These scripts are used to start/stop the 3DOrchestrate Distribution Server in "CATALINA" mode. CATALINA mode is the default, natural way to use the TomEE application server with the default scripts delivered in any standard TomEE installation. In the 3DOrchestrate Distribution Server installation, these scripts are contained in the following directory/folder:

<server_install_dir>/<os>/code/tomee172/bin/

The relevant files are:

catalina.[bat|sh]
startup.[bat|sh]
shutdown.[bat|sh]

The startup sequence therefore looks like this:

     CATALINA_BASE                                                  CATALINA_HOME

<server_install_dir>\exe1\tomee                               <server_install_dir>\win_b64\code\tomee172

    ..\bin\startup
               |
               +-------------------------------------------------> ..\bin\startup
                                                                             |
                                                                             +-> ..\bin\catalina
                                                                                              |
    ..\bin\setenv <--------------------------------- CALL ------------------------------------+
                                                                                              |
                                                                                              +---> java ...

The same sequence applies for shutting down the 3DOrchestrate Distribution Server, and is also what happens when you use the following Server Actions from the 3DOrchestrate deployment utility:

  • Start server
  • Stop server

By default, the 3DOrchestrate Distribution Server is configured with no JVM settings for memory sizing and garbage collection. Thus the Java ergonomics will fully apply and configure the JVM to use:

  • Parallel Stop The World (STW) garbage collection (GC) algorithm for both young (-XX:+UseParallelGC) and old (-XX:+UseOldParallelGC) generation objects
  • Maximum heap size of one-fourth (1/4) of the total amount of available memory

If this configuration is not appropriate for your 3DOrchestrate Distribution Server execution environment, you can override the ergonomics defaults by explicitly specifying the necessary settings. To do this, you use an external environment variable named CATALINA_OPTS. This environment variable is fully supported by TomEE and is defined as follows (on Windows):

rem   CATALINA_OPTS   (Optional) Java runtime options used when the "start",
rem                   "run" or "debug" command is executed.
rem                   Include here (and not in JAVA_OPTS) all options, that should
rem                   only be used by Tomcat itself, not by the stop process,
rem                   the version command etc.
rem                   Examples are heap size, GC logging, JMX ports etc.

By using CATALINA_OPTS, there is no need to modify any scripts in the TomEE startup sequence. In particular, it recommended that you not modify the setenv.[bat|sh] file under CATALINA_BASE because your modifications will be lost if the deployment utility is reused to reconfigure the 3DOrchestrate Distribution Server application.

For example, after the 3DOrchestrate Distribution Server is configured at least once from the 3DOrchestrate deployment utility, the following command sequence will display (in the JVM console) the final Java ergonomics settings while starting the 3DOrchestrate Distribution Server application:

cd <server_install_dir>
set CATALINA_OPTS=-XshowSettings:vm -XX:+PrintCommandLineFlags -showversion
.\win_b64\reffiles\SMAExeServer\deploy\smaexe-deploy.bat -v .\config\deploy.param start

To force the maximum heap size (-Xmx) to be 6 GB and to capture the ergonomics information, you would use the following command sequence:

cd <server_install_dir>
set CATALINA_OPTS=-Xmx6g -XshowSettings:vm -XX:+PrintCommandLineFlags -showversion
.\win_b64\reffiles\SMAExeServer\deploy\smaexe-deploy.bat -v .\config\deploy.param start

To force the maximum heap size to be 6 GB and force the garbage collection algorithm to be G1 GC while not capturing the ergonomics information, you would use the following commands:

cd <server_install_dir>
set CATALINA_OPTS=-Xmx6g -XX:+UseG1GC
.\win_b64\reffiles\SMAExeServer\deploy\smaexe-deploy.bat -v .\config\deploy.param start

To force the maximum heap size to be 25 GB (for example on a machine with 48 GB RAM) and force the garbage collection algorithm to be G1 GC while capturing all diagnostic information, you would use the following commands:

cd <server_install_dir>
set CATALINA_OPTS=-Xmx25g -XshowSettings:all -XX:+UseG1GC -XX:+PrintCommandLineFlags -XX:+PrintFlagsFinal -showversion
.\win_b64\reffiles\SMAExeServer\deploy\smaexe-deploy.bat -v .\config\deploy.param start

For this example, the output in the JVM console would look like this:

-XX:InitialHeapSize=803921472 -XX:MaxHeapSize=26843545600 -XX:+PrintCommandLineFlags 
-XX:+PrintFlagsFinal -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:+UseG1GC 
-XX:-UseLargePagesIndividualAllocation
[Global flags]
    uintx AdaptiveSizeDecrementScaleFactor          = 4                                   {product}
    uintx AdaptiveSizeMajorGCDecayTimeScale         = 10                                  {product}
    uintx AdaptiveSizePausePolicy                   = 0                                   {product}
    uintx AdaptiveSizePolicyCollectionCostMargin    = 50                                  {product}
    uintx AdaptiveSizePolicyInitializingSteps       = 20                                  {product}

...

     bool VerifySharedSpaces                        = false                               {product}
     intx WorkAroundNPTLTimedWaitHang               = 1                                   {product}
    uintx YoungGenerationSizeIncrement              = 20                                  {product}
    uintx YoungGenerationSizeSupplement             = 80                                  {product}
    uintx YoungGenerationSizeSupplementDecay        = 8                                   {product}
    uintx YoungPLABSize                             = 4096                                {product}
     bool ZeroTLAB                                  = false                               {product}
     intx hashCode                                  = 5                                   {product}
VM settings:
    Max. Heap Size: 25.00G
    Ergonomics Machine Class: client
    Using VM: Java HotSpot(TM) 64-Bit Server VM

...

java version "1.8.0_66"
Java(TM) SE Runtime Environment (build 1.8.0_66-b18)
Java HotSpot(TM) 64-Bit Server VM (build 25.66-b18, mixed mode)

...

************** BEGIN LOGGING ****************
************** 11/7/16 2:54 PM
************** Build 6.419-0
************** Build Date 2016-11-07 13:20:58
*********************************************
ServerStartAndShutdown.startup() starting
Nov 07, 2016 2:54:01 PM com.dassault_systemes.smaexe.ejb.SMAExeApplicationStartAndShutdown
ALWAYS: Compute Orchestration Server (SINGLE) starting on server "C:\tomee172".
Nov 07, 2016 2:54:01 PM com.dassault_systemes.smaexe.ejb.SMAExeApplicationStartAndShutdown
ALWAYS: Compute Orchestration Server Host Operating System Version: Microsoft Windows Server 2008 R2 
  Enterprise Edition Service Pack 1 (build 7601), 64-bit
Nov 07, 2016 2:54:01 PM com.dassault_systemes.smaexe.ejb.SMAExeApplicationStartAndShutdown
ALWAYS: Compute Orchestration Server build 6.419.0 [2016-11-07 13:20:58]
...
Nov 07, 2016 2:54:01 PM com.dassault_systemes.smaexe.ejb.SMAExeApplicationStartAndShutdown
ALWAYS: Last known ACS state before startup was "STOPPED".
Nov 07, 2016 2:54:01 PM com.dassault_systemes.smaexe.ejb.SMAExeApplicationStartAndShutdown
ALWAYS: Compute Orchestration Server initialization starting.
...
Nov 07, 2016 2:54:02 PM com.dassault_systemes.smaexe.ejb.SMAExeApplicationStartAndShutdown
ALWAYS: Initialization cleaner completed.
Nov 07, 2016 2:54:03 PM com.dassault_systemes.smaexe.ejb.SMAExeApplicationStartAndShutdown
ALWAYS: Compute Orchestration Server server is now in RUNNING state.
Nov 07, 2016 2:54:03 PM
STDOUT: ServerStartAndShutdown.startup() complete
...