Specifying JVM arguments and system properties
You can tune system behavior and performance using JVM arguments and system properties.
The following formats are used for specifying system properties:
- In the environment file:
<propertyName>="<value>"
, for example,port.offset="100"
- In
modeld.conf
:<propertyName>=<value>
, for example,port.offset=100
Using an -X<argument> in the
jvm.conf
file or in the command line:
For example,-Xss4096k
to change the default thread stack size to4096k
- Using a -D<property> in the
jvm.
conf
file or in the command line:-Dnexj.<propertyName>=<value>
, for example,-Dnexj.port.offset=100
The jvm.conf
and modeld.conf
files are located in the <SERVER_HOME>\conf
folder.
There are three types of system properties:
General Java system properties
General JVM arguments, including JVM heap size, thread size, and garbage collection time, can be specified in the jvm.conf
file. You can also add JVM arguments using an -X<argument> in the command line when starting the application or when registering NexJ Model Server as a Windows service.
The jvm.conf
file is not used when registering Model Server as a service on Linux. To edit JVM arguments when registering Model Server as a service on Linux, you must modify the JVM arguments directly in the modeld.service
file.
If you modify the jvm.conf
file after registering Model Server as a service on Windows, you must unregister and re-register the service for the changes to take effect.
For information about commonly used Java system properties, see https://docs.oracle.com/cd/E13150_01/jrockit_jvm/jrockit/jrdocs/refman/optionX.html.
Tomcat connector system properties
Tomcat connector attributes, such as web container thread pool size, are specified as system properties for Model Server. They can be specified using the environment file, using the modeld.conf
file, or using a -D<property> in the command line when running the application.
For more information, see Configuring Tomcat connector properties. For information about common Tomcat connector attributes, see https://tomcat.apache.org/tomcat-8.5-doc/config/http.html or https://tomcat.apache.org/tomcat-8.5-doc/config/ajp.html.
NexJ application-specific properties
Like Tomcat connector properties, NexJ application-specific properties, such as node
, port.offset
, and clusterMemoryThreshold
, can also be specified in any of three ways: using the environment file, using modeld.conf
, or using a -D<property> in the command line.
In case of a conflict, the value specified for a property using the -D<property> takes precedence, followed by the value specified in modeld.conf
. If a value is not specified in either of these, the value specified in the environment file is used.
All NexJ application-specific system properties can be edited in the environment file in the Deployment layer of NexJ Studio. The following table lists a few important properties.
Property | Description |
---|---|
channelWarningTimeout | Time in milliseconds after which a warning is generated. |
clusterCPUThreshold | The CPU usage at which a node is considered busy. |
clusterMemoryLimit | Percentage utilization of the total heap at which memory usage at which a node is considered overloaded. |
clusterMemoryThreshold | The memory usage at which a node is considered busy. |
eventAudit | If true, enables event-triggered audit logging. |
httpMaxSize | Maximum HTTP request size in bytes. |
maxPoolSize | Maximum database connection pool size per server. |
minPoolSize | Minimum database connection pool size per server. |
persistentSession | If true, enables session persistence and load balancing. |
readAudit | Read auditing level. Options are: actions, attributes, values, and none. |
transactionTimeout | Time in seconds after which a transaction times out. |
updateAudit | If true, enables attribute-triggered audit logging for object creates, updates, and deletes. |
Binding a JVM to a specific host or IP
You can bind a JVM to a specific host or IP address using the bind.address property. You can specify this property in the modeld.conf
file or using a -D property in the
file.jvm.conf
The following example shows how to specify the bind address in the two files:
In jvm.conf
:-Dnexj.bind.address=<host/IP>
In modeld.conf
:
bind.address=<host/IP>
Updating the location of the JVM directory contents
In some cases, when using custom libraries such as DynaTrace or Jolokia as part of your integration, you may want to augment the NexJ Server jvm
folder with contents from another location to avoid any accidental overwriting of the files. To do this, you can use the bootstrap.classpath.suffix argument.
The following example shows use of the argument within the jvm.conf
file to augment the jvm
contents with those from the /opt/nexj/publish/
directory.
-Dnexj.bootstrap.classpath.suffix=/opt/nexj/publish/*.jar