20.3. JVM Tuning

SavaPage runs in the Java Virtual Machine (JVM) using the class libraries and other supporting files provided in the JRE.

The SavaPage JVM settings work fine, and generally there is no customization needed. However, if needed the JVM can be tuned by adding extra JVM arguments in the file:

/opt/savapage/server/custom/app-server.conf

Edit this file as savapage user and enter the extra JVM arguments as value of the CUSTOM_JVM_ARGS key. The example below shows the JVM arguments as explained in the next sections.

# Note: enclose the value with quotes
CUSTOM_JVM_ARGS="-XX:DefaultMaxRAMFraction=2 -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode"

The location of temporary files can be overwritten with the JAVA_IO_TMPDIR key. See Section 20.3.3, “JVM Temporary Files”.

Important

Before doing any JVM customizing please consult SavaPage Support to discuss your requirements and which customization fits best.

20.3.1. JVM Memory Allocation

The JVM allocates a quarter of host system RAM to the SavaPage Server process by default. This ensures that SavaPage does not consume too many resources and does not get in the way of other applications running on the same system.

However, if the host system is dedicated to running SavaPage, you can safely allocate more memory to SavaPage. With more allocated memory SavaPage will have a better performance, particularly with many users and large printing throughput.

Add one of the following JVM parameters to allocate relative or absolute memory:

-XX:DefaultMaxRAMFraction=3               1
-XX:DefaultMaxRAMFraction=2               2
-Xmx864m                                  3

1

Allocate one third of host system RAM.

2

Allocate one half of host system RAM.

3

Allocate 864MB of host system RAM.

20.3.2. JVM Garbage Collection

Customizing Java Garbage Collection (GC) depends on the characteristics of the application involved. The JVM provide proper defaults for SavaPage most of the time.

However, if you consider response time more important than overall throughput and garbage collection pauses must be kept shorter than approximately one second, then select the concurrent collector with the -XX:+UseConcMarkSweepGC option. Also, if only one or two processors are available, consider combining this collector with the -XX:+CMSIncrementalMode option.

Please consult the Java SE HotSpot Oracle documentation for an introduction to these tuning options.

20.3.3. JVM Temporary Files

The Java system property java.io.tmpdir determines where the JVM writes temporary files. The default value typically points to the world readable /tmp directory. As a result, all Java components that are part of the SavaPage application will write their temporary files to that directory. You can override the default in:

/opt/savapage/server/custom/app-server.conf

Edit this file as savapage user and specify the alternative temp directory at the JAVA_IO_TMPDIR variable.

# Overwrite of JVM system property 'java.io.tmpdir' 
# User 'savapage' must have mode 700 access to this directory. 
#JAVA_IO_TMPDIR=

Caution

Use the JAVA_IO_TMPDIR setting with the utmost care. Make sure the directory is exclusively used by the SavaPage applicartion, and is accessible by the savapage system user only. If these conditions are not met, SavaPage will not start and might get corrupted.

Among all Java third-party components, SavaPage components take a special position because they write their own temp files in a subdirectory of java.io.tmpdir, called savapage. This subdirectory is created when the application starts and removed when stopped. You can override this special location with the app.dir.tmp property in the server.properties file. See Section 11.3.4, “Alternative File Locations”.

Caution

Make sure that the special temp directory used by SavaPage resides on the same disk partition as the other file locations that are used to store SavaPage data on runtime. See: