22.3. JVM Tuning
22.3.1. Introduction
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 examples below shows the JVM
arguments as explained in the next sections.
# JDK 11
# Note: enclose the value with quotes
CUSTOM_JVM_ARGS="-XX:MaxRAMFraction=2"
The location of temporary files can be overwritten with the
JAVA_IO_TMPDIR key. See JVM Temporary Files.
Important
Before doing any JVM customizing please consult SavaPage Support to discuss your requirements and which customization fits best.
22.3.2. 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:MaxRAMFraction=3 ①
-XX:MaxRAMFraction=2 ②
-Xmx864m ③
- 1:
Allocate one third of host system RAM.
- 2:
Allocate one half of host system RAM.
- 3:
Allocate 864MB of host system RAM.
22.3.3. JVM Garbage Collection
Customizing Java Garbage Collection (GC) depends on the characteristics of the application involved. The JVM provides proper defaults for SavaPage most of the time. See OpenJDK Wiki for an introduction to GC options.
22.3.4. 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 application,
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
/opt/savapage/server/data/.tmp . This directory 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 Alternative File Locations.
