Managing the Background Threads

The Cleaner Thread
The Checkpointer Thread

JE uses some background threads to keep your database resources within pre-configured limits. If they are going to run, the background threads are started once per application per process. That is, if your application opens the same environment multiple times, the background threads will be started just once for that process. See the following list for the default conditions that gate whether an individual thread is run. Note that you can prevent a background thread from running by using the appropriate je.properties parameter, but this is not recommended for production use and those parameters are not described here.

The background threads are:

The Cleaner Thread

The cleaner thread is responsible for cleaning, or compacting, your log files for you. Log file cleaning is described in Cleaning the Log Files.

The following two properties may be of interest to you when managing the cleaner thread:

  • je.cleaner.minUtilization

    Identifies the percentage of the log file space that must be used for utilized records. If the percentage of log file space used by utilized records is too low, then the cleaner removes obsolete records until this threshold is reached. Default is 50%.

  • je.cleaner.expunge

    Identifies the cleaner's behavior in the event that it is able to remove a log file. If true, the log files that have been cleaned are deleted from the file system. If false, the log files that have been cleaned are renamed from NNNNNNNN.jdb to NNNNNNNN.del. You are then responsible for deleting the renamed files.

Note that the cleaner thread runs only if the environment is opened for write access. Also, be aware that the cleaner is not guaranteed to finish running before the environment is closed, which can result in unexpectedly large log files. See Closing Database Environments for more information.

The Checkpointer Thread

Automatically runs checkpoints. Checkpoints and the administration of this thread are described in the Berkeley DB, Java Edition Getting Started with Transaction Processing guide.