7.1Optimization using JVM options
The Java Virtual Machine is undergoing permanent optimiziations. These can be used to enhance performance in speed and memory allocation of cmsWorks.
Despite the programming skills and quality of algorithms that surely are capable to enhance the overall performance of a system, the JVM provides additional mechanisms to enhance the throughput of cmsWorks.
The "-server" flag of the JVM
In general it is a good idea to activate the server JVM by including the flag "-server" into the batch file that starts a long living java application like cmsWorks.
The -server flag increases the starting time of a java application (the starting, for a server, should not happen too often), but also maximizes peak operation speed. Additionally, on the compiler level, the -server flag has more optimization methods while compiling the Java classes ("advanced adaptive compiler") resulting in faster running code in the long term.
In cmsWorks the -server flag is configured on by default in the starting batch file.
Optimizing JVM memory allocation for cmsWorks
The JVM can be parameterized with the memory flag "-Xmx" at starting time which is the maximum heap size (). In fact, cmsWorks can start up and run without touching the "standard" memory settings. cmsWorks itself comes with a very small footprint at startup (normally less than 20 MB) but uses configurable caches to speed up the generation of content.
So in a running environment, when bigger caches in cmsWorks are configured, it is necessary to grant more memory to the JVM. This way the system does not run out of memory. Depending on the estimated size of the memory used by the cmsWorks caches, the JVM maximum heap size has to be increased.
And, as a rule of thumb, the JVM should at very least have 1 GB spare memory in case the caches are filled completely. This is because cmsWorks needs memory for internal procedures and the generation of content, too.
Assuming the cmsWorks caches will need 2GB at most, then the "-Xmx" - flag should be set to at least 3 gigabyte ("-Xmx3072M"), better to 3.5 gigabyte ("-Xmx=3584m"). You can check the real memory usage with the "memory" - command in the telnet server.
Be aware that bigger memory settings will result in longer garbage collections of the JVM so the JVM has to stop-the-world (STW) more often, if not otherwise configured. The bigger the heap memory of a JVM is, the longer these STW-intervals will last. In the stop-the-world time intervals cmsWorks will not be responsive and generate content. So taking the server hardware in account, its memory, processor cores and processor speed, it is a good advice to not exaggerate the value for the maximum heap.
In cmsWorks the "-Xmx" - flag is configured in the startup shell "cmsworks.sh" (Linux / *ix) or "cmsworks.bat" (Windows).
Mandatory JVM options
In any case the JVM option
--add-exports=java.base/com.sun.crypto.provider=ALL-UNNAMED com.topasworks.Server
has to be included into the startup shell "cmsworks.sh" (Linux / *ix) or "cmsworks.bat" (Windows).
