The JVM is loaded into FairCom DB SQL and becomes part of the process when the appropriate configuration options point to a valid Java Runtime Engine (JRE). Stored procedures, triggers, and user-defined functions are executed within this JVM. The JVM environment can be configured and tuned with numerous options. The deployment architect should be familiar with these options from the available Oracle Java documentation.
The SETENV DH_JVM_OPTION_STRINGS configuration keyword can be used to specify exact parameters for the JVM to use at runtime.
Note: Java stored procedures and triggers developers may take advantage of many different Java features and have wide latitude in creating stored procedure logic. Due to this, it is difficult to make general recommendations, however, information and links are provided below to demonstrate the vast variety of options available.
Different options may be available on different platforms as Java is a highly cross-platform environment.
One of the most important considerations is memory usage of the JVM. This can result in unexpected memory usage of the FairCom DB SQL process. As the JVM gradually allocates additional heap memory, the process space can grow quite unexpectedly. While Java takes advantage of advanced automatic garbage collection of unused memory references, the triggers for this are many, and in some cases, require careful tuning for the best balance of performance and memory use. Two options of immediate use are the minimum and maximum size of the memory heap.
The JVM defaults to certain proportions of available memory, depending on the OS and if the process is 32-bit or 64-bit.
The initial heap size of the JVM is the following:
You can specify the initial (and minimum) JVM heap size with the -Xms option.
Note: The initial Java heap cannot be set to a value smaller than 8 MB, which is the minimum Java heap size. If you attempt to set it to a smaller value, JVM defaults to 8 MB.
The -Xms value cannot exceed the value set for -Xmx (the maximum Java heap size).
The maximum heap size of the JVM is the following:
You can specify the maximum JVM heap size with the -Xmx command-line option.
Alternative Garbage Collectors
Alternative garbage collectors (GC) are available within the JVM. For particular environments, it may be advantageous to choose an alternate GC for throughput or latency reasons.
Many numerous options are available to tune each of the Java garbage collectors for performance, throughput and low-latency. Check the current Java documentation for your chosen JVM for complete details.
It is frequently necessary to examine actual garbage collection statistics. Java garbage collection has many debugging options available for this task. Here is a minimum set to consider:
The JVisualVM utility included with your Java installation is recommended for advanced monitoring of the Java GC process. Load the Visual GC plugin from the "Tools->Plugins" menu.