OpenDJ performance tuning

A few tips on tuning OpenDJ.

Java heap size

This one is pretty straightforward. OpenDJ will run in a very small JVM heap, but once you get up past 10,000 entries or so you’re going to feel the need for more memory.

The rule of thumb (found in Tuning OpenDJ Process Size) is to take the total size of the backend files (e.g. $OPENDJ_HOME/db/userRoot, where “$OPENDJ_HOME” is the folder where you installed the OpenDJ binaries) and double it for an estimate of the amount of memory you’ll need.

Increase the heap size by editing:

$OPENDJ_HOME/config/java.properties

and adding to the start-ds.java-args line:

start-ds.java-args=-server -Xms2G -Xmx2G

Then run $OPENDJ_HOME/bin/dsjavaproperties to update the system (note that on really big directories that have more memory available you might want to bump up to 4G or more to increase the overhead available to the server).

Note that, as recommended in the above tuning article, you should keep the start up (Xms) and maximum (Xmx) heap sizes the same in order to avoid a pause in operations caused by the JVM running a full garbage collection cycle whenever it increases its heap.

Database Cache

Ludo did an eye-opening article awhile back, Cache strategy for OpenDJ LDAP directory server that covers the theory. Here are the mechanics.

By default OpenDJ v2.4.5 uses 10% of its heap to database cache. The soon-to-be-released v2.5.x will increase this to 50%. If you want to increase your old 2.4.5 server’s cache to the same, use this command:

dsconfig set-backend-prop 
-p 5444 
-j /path/to/your/pwd/file 
--backend-name userRoot 
--set db-cache-percent:50 
-X -n