Configuring the Default JVM and Java Arguments
The directory server provides a means of configuring the Java Virtual Machine (JVM)
and Java options for each command-line utility and for the directory server itself.
The Java configuration is provided in a properties file, located at instance-dir/OUD/config/java.properties. The configuration
specified in this file is taken into account each time the dsjavaproperties
command is run. If you do not run the dsjavaproperties command, the
properties file is ignored.
The properties file can be used to specify (among other arguments) whether a
command runs using the JVM in -server mode or -client mode. By
default, all client applications run in -client mode, while the directory server and
certain server utilities run in -server mode. Generally, -server mode provides higher throughput
than -client mode, at the expense of slightly longer startup times.
For certain commands (import-ldif, export-ldif, backup, and restore) you can also specify
different Java arguments (and a different JVM) depending on whether the command is
run in online or offline mode.
The Java Properties File Format
The Java properties file has the following format.
The following table shows three properties present in the java.properties file that
are of particular importance.
|
|
overwrite-env-java-args |
If True, the system checks the default.java-args property in
this properties file before the checking the OPENDS_JAVA_ARGS environment variable. If false,
the system checks the OPENDS_JAVA_ARGS environment variable first. |
default.java-home |
Sets the JVM that will be
used for the directory server and for all of its command-line utilities, unless
a different JVM is specified for a particular utility. |
|
Configuring JVM Options
The following table summarizes the Java options that can have an impact on
server performance. Note that some of these options apply only to the
Sun JVM.
|
|
|
|
-server |
Selects server application runtime optimizations. The directory server will take longer to start
and “warm up” but will be more aggressively optimized to produce higher throughput. |
|
-d64 |
For
64-bit machines only. By default, the directory server selects a 32-bit JVM regardless
of the architecture. This options should be specified when a large JVM heap
is required (greater than 4 Gytes) and the architecture is 64-bit. |
|
-Xms2G -Xmx2G |
Selects the initial
and maximum memory sizes available to the JVM, respectively. These values are used
for the JVM heap, which reserves memory for the directory server and its
database (DB) cache (or caches if more than one). Increasing the amount of
memory available can improve performance, but increasing it to too high a value
can have a detrimental effect in the form of longer pauses for full
garbage collection runs. Therefore, the initial and maximum sizes should be set to
the same value. As a general guideline, take a look at
the size of the Oracle Berkeley Java Edition (JE) database folders ( instance-dir/OUD/db/userRoot). Based
on the folders' combined size, determine how much memory you want to reserve
for the DB cache. After determining this value, tune the local DB back-end
properties, db-cache-percent or db-cache-size and other JVM options appropriately. Be careful to allow
additional memory for the server runtime. For example, if you have a single
database of 1 Gbyte, which you want to store entirely in memory, then
a 2 Gbyte heap with 60% reserved for the DB cache should
be sufficient for efficient directory server performance. You can test this setup by preloading
the database with the local database back end by using the preload-time-limit
property. JVM heaps greater than 4 Gbytes require a 64-bit JVM. |
|
DisableExplicitGC |
Prevents external
applications from forcing expensive garbage collections. If you are using jstatd or other
RMI-based applications to monitor Oracle Unified Directory, you should consider using this option
in order to avoid unexpected pauses. |
|
-XX:NewSize=512M |
In heavy throughput environments, you should consider using
this option to increase the size of the JVM young generation. By default,
the young generation is quite small, and high throughput scenarios can result in
a large amount of generated garbage. This garbage collection, in turn, causes the
JVM to inadvertently promote short-lived objects into the old generation. |
Server Only |
-XX:+UseConcMarkSweepGC |
Selects the CMS
garbage collector. This garbage collector is set for low pause time. It will result
in a Java application that has a lower average throughput, but much shorter
CPU-intensive garbage collections. This option is required in environments that have response time
constraints. |
|
-XX:CMSInitiatingOccupancyFraction=70 |
Selects the level at which the collection is started. The default value is
68%. |
Offline Import Only |
-XX:+UseParallelOldGC |
Selects the parallel old generational garbage collector. This garbage collector
is set for high throughput. It will maximize the average throughput of the import-ldif
utility at the cost of an occasional stop-the-world garbage collection, which is not
as critical to imports. |
|
-XX:+PrintGCDetails |
Prints the garbage collection details. |
|
-XX:+PrintGCTimeStamps |
Prints the garbage collection time stamps
to help with debugging. |
Other Applications (for example, dsconfig) |
-client |
Selects client application run-time optimizations.
The application will be faster to start and more responsive due to lower
compilation overheads. |
|
-Xms8m |
Selects a low initial JVM heap size for an application. |
|
To Specify the JAVA_HOME Environment Variable for a Specific Utility
- Edit the Java properties file as follows: command-name.java-home=jvm.
For example, to specify a particular JDK 1.6 for the offline import, edit
the line that starts with import-ldif.offline in the java.properties file, as follows: import-ldif.offline.java-home=/usr/jdk1.6.
- Run the dsjavaproperties command to apply the property.
To Specify the Java Arguments for a Specific Utility
- Edit the Java properties file as follows: command-name.java-args=arguments.
For example, to specify that a maximum heap size of 256 Mbytes be
used for the online export, edit the line that starts with export-ldif.online
in the java.properties file, as follows: export-ldif.online.java-args=-Xms256m -Xmx256m.
- Run the dsjavaproperties command to apply the property.