Running normal recovery can become expensive if over time all that is ever written to disk is BTree leaf nodes. So in order to limit the time required for normal recovery, JE runs checkpoints. Checkpoints write to your log files all the internal BTree nodes and structures modified as a part of write operations. This means that your log files contain a complete BTree up to the moment in time when the checkpoint was run. The result is that normal recovery only needs to recreate the portion of the BTree that has been modified since the time of the last checkpoint.
Checkpoints typically write more information to disk than do transaction commits, and so they are more expensive from a disk I/O perspective. You will therefore need to consider how frequently to run checkpoints as a part of your performance tuning activities. When you do this, balance the cost of the checkpoints against the time it will take your application to restart due to the cost of running normal recovery.
Checkpoints are normally performed by the checkpointer background thread, which is always running. Like
all background threads, it is managed using the je.properties
file. Currently, the
only checkpointer property that you may want to manage is
je.checkpointer.bytesInterval
. This property identifies how much JE's log files
can grow before a checkpoint is run. Its value is specified in bytes. Decreasing this value causes the
checkpointer thread to run checkpoints more frequently. This will improve the time that it takes to run
recovery, but it also increases the system resources (notably, I/O) required by JE.
Note that checkpoints are also always performed when the environment is closed normally. Therefore,
normal recovery only has work to do if the application crashes or otherwise ends abnormally without
calling Environment.close()
.