How to parameterize JVM arguments in the StreamBase Engine configuration

How to parameterize JVM arguments in the StreamBase Engine configuration

book

Article ID: KB0071504

calendar_today

Updated On:

Products Versions
TIBCO Streaming 10.6 and later

Description

This article describes how to parameterize the JVM arguments for a Streaming application for different environments (e.g. dev/UAT/prod).

Issue/Introduction

This article outlines an approach for parameterizing JVM arguments for a StreamBase Engine. This can be done in the HOCON configuration file.

Resolution

JVM arguments can be hard-coded into a StreamBase Engine HOCON configuration file. For example..
 
jvmArgs = [
      "-Xmx3g"
      "-Xms512m"
      "-XX:+UseG1GC"
      "-XX:MaxGCPauseMillis=500"
      "-XX:ConcGCThreads=1"
    ]

Note that each argument is separated from the others via double-quotes.

In this case, you may represent each JVM argument in a substitution variable. Substitution variables are discussed further in the Help under Home > Configuration Guide > HOCON Configuration Introduction > HOCON Substitution Variables.

For example:
 
jvmArgs = [
      ${JVM_ARG_1:-"-Xmx3g"}
      ${JVM_ARG_2:-"-Xms512m"}
      ${JVM_ARG_3:-"-XX:+UseG1GC"}
      ${JVM_ARG_4:-"-XX:MaxGCPauseMillis=500"}
      ${JVM_ARG_5:-"-XX:ConcGCThreads=1"}
    ]

Using the above configuration, you could, for example, change the max heap size (-Xmx) to 4g. This would override the default value of 3g. This can be set when the node is installed. For example:
 
epadmin install node --nodename my.node --nodedirectory nodes 
--application app-archive.zip --substitutions "JVM_ARG_1=-Xmx4g"