Java Virtual Machine (JVM) is required not only to execute code but also to enhance speed by managing memory. JVM helps in improving the performance of servers and to eliminate out of memory error by managing memory.
JVM 32 bit Vs JVM 64 bit
While choosing a JVM, either 32-bit or 64-bit can be considered depending on the server machine architecture. A 32-bit Java Development Kit (JDK) can be used with 64-bit architecture but 64 bit JVM is highly recommended in a production environment where the servers will need more memory. 64-bit JVM can be used when there is a huge memory requirement for a process and the amount of memory taken by JVM is generally more.
Ideally, servers can be run using 64 bit JDK and components can be set to use 32 bit JDK, and the memory being used can be monitored in Fiorano Dashboard.
Example: For a process that takes 1 GB memory in 32 bit where it is the maximum needed, prefer 32 bit, whereas for a process that needs around 3 to 4 GB, a 64 bit JVM is required because a 32 bit JVM can accommodate around 2 GB only.
Setting up Java
The Fiorano Platform needs Java Runtime Environment (JRE) to function properly. To setup this environment, refer the Setting up Java section.
Understanding Memory Usage
The JVM memory mainly consists of the segments: Heap and Non-Heap.
Heap Memory
Heap memory is the runtime data area from which memory for all class instances and arrays are allocated. Most of the data related to messages are stored in heap.
The heap size may be configured with the following VM options:
- -Xmx<size> - to set the maximum Java heap size. Set the maximum Java heap size so that there is 70% occupancy at the highest point
- -Xms<size> - to set the initial Java heap size. Set the minimum heap size so that the Java heap is 40% occupied at its lowest memory usage. By default, the maximum heap size is 64 Mb.
Non-Heap Memory
Used by Java to store loaded classes and other meta-data (Java class definitions etc) corresponding to the messages. It stores per-class structures such as runtime constant pool, field and method data, and the code for methods and constructors, as well as interned Strings.
The Non-heap size may be configured with '-XX:MaxPermSize' option.
Fiorano Dashboard
In Fiorano Dashboard, the split-up of Heap and Non-Heap Memory usage for each Server Type and CCP enabled components are available.
Server Example:
Figure 1: Screenshot of Server Status in Dashboard
Component Example:
Figure 2: Screenshot of microservice Details in Applications taken from the Dashboard
In the screenshot of Server Status (Figure 1) taken from the Dashboard, the Memory Usage of fes server reads as below:
- Heap: 137MB/910MB
- Non-Heap: 33MB/304MB
Below are the implications of the above values:
- 137MB/910MB of Heap implies that 123MB of memory is presently being used and 910MB is the maximum amount of memory that can be allocated.
- Total memory being used by fes is the sum of Heap and Non-Heap used memory, that is, 137MB + 33MB =170MB.
- Total memory that can be allocated is, similar to the used memory, the sum Heap and Non-Heap allocated memory: 910MB + 304MB = 1214MB.
Configuring the Heap size
Heap size allocated for maximum memory can be customized/optimized by configuring the Heap size, which is explained in the sections below:
Route Transformations
When user transforms XSLT component to route transformation, the transformation happens in peer JVM.
All the memory details can be checked in Dashboard and should be fine-tuned based on the requirement.