Library Version 12.1.6.0

Managing the Background Threads
Prev | Chapter 12. Administering Berkeley DB Java Edition Applications | Next

## Managing the Background Threads

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:

- Cleaner thread.

  Responsible for cleaning and deleting unused log files. See The Cleaner Thread for more information.

  This thread is run only if the environment is opened for write access.

- Compressor thread.

  Responsible for cleaning up the internal BTree as database records are deleted. The compressor thread ensures that the BTree does not contain unused nodes. There is no need for you to manage the compressor and so it is not described further in this manual.

  This thread is run only if the environment is opened for write access.

- Checkpointer thread.

  Responsible for running checkpoints on your environment. See The Checkpointer Thread for more information.

  This thread always runs.

### 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.

Prev | Up | Next
Chapter 12. Administering Berkeley DB Java Edition Applications | Home | Sizing the Cache