ServiceNow Connector > Toubleshooting > Best practices for increasing memory of the Secure Agent
  

Best practices for increasing memory of the Secure Agent

You can increase the memory for different operations of the Secure Agent in the System Configuration Details section for types DTM and Tomcat JRE.

Tomcat JRE

Problem: You might encounter memory related or Java heap related error messages when you perform the following tasks:
Solution: Increase the memory options for the INFA_MEMORY attribute for type Tomcat JRE. Use the following format: "-Xms***m -Xmx****m -XX:MaxPermSize=***m"

DTM

Problem: You might encounter Java out-of-memory, Java heap space, out-of-memory, or perGen space error messages either in the session log or the activity log, or both.
Solution: You can specify the default options of JVMOption1, JVMOption2, JVMOption3, and so on. If you have specified all the available JVMOptions, you can add additional options as custom properties for the Secure Agent.
Ensure that you maintain the sequence. If the default ones that you specified stop at JVMOption5, you must add custom properties that start with JVMOption6. Specify the type as DTM and subtype as INFO. Each JVMOption must hold only one JVM property.
The main JAVA memory properties are -Xms**m, -Xmx****m, and -XX:MaxPermSize=***m.

INFA_MEMORY and JVMOptions

You must specify the following memory attributes in the INFA_MEMORY and JVMoptions:
-Xms***m
The initial value that specifies the amount of memory with which the Java Virtual Machine starts. The memory value you specify for this attribute is allocated when the Java process starts.
-Xmx****m
The value that specifies the maximum amount of memory that the Java Virtual Machine can allocate as heap. After the Java process starts, it will continue allocating more space to store its objects. The allocation continues until it reaches the maximum setting, after which the Java process crashes with a Java heap space or out-of-memory issue.
-XX:MaxPermSize=***m
The maximum permissible size that the Java Virtual Machine can use at a given time. If the Java Virtual Machine requires more than the specified amount, the Java process crashes with a permGem space issue.

Set the Required Values

You must set the following values for the attributes:
-Xms**m
This value represents the base or initial value. You can specify a minimum value, such as 64M or 128M. This value specifies the amount of memory used for the process initialization. The Java process eventually continues to allocate space as and when it requires.
-Xmx***m
This value represents the maximum value to which the Java heap can grow. The value must be large such that it can hold all the Java objects and classes.
On a 32-bit Secure Agent, you can specify a value that must not exceed 1024M for Windows and 2048M for Linux due to operating system limitations for a 32-bit application. However, it is recommended that you do not specify a value beyond 900M for 32-bit Secure Agents to avoid memory issues for tasks in general and for the Secure Agent.
If the process fails with 900M or higher on a 32-bit Secure Agent, you must use a 64-bit Secure Agent. For a 64-bit Secure Agent, you can specify any -Xmx value, which is limited only by the system memory that the operating system allocates to the system. Generally, on a 64-bit Secure Agent, you can specify a value of about 1024M or 2048M. However, if your tasks fail with a Java heap space or out-of-memory error, you must increase the value further, based on trial and error, as the value is dependent on the amount of data, the classes loaded, and how the Java and operating system stores the data.