Chapter 6. Managing the Database Cache Settings

Directory Server uses the following caches:
  • The Entry cache, which contains individual directory entries.
  • The DN cache is used to associate DNs and RDNs with entries.
  • The Database cache, which contains the database index files *.db and *.db4 files.
For the highest performance improvements, all cache sizes must be able to store all of their records. If you do not use the recommended auto-sizing feature and have not enough RAM available, assign free memory to the caches in the previously shown order.

6.1. The Database and Entry Cache Auto-Sizing Feature

By default, Directory Server automatically determine the optimized size for the database and entry cache. Auto-sizing optimizes the size of both caches based on the hardware resources of the server when the instance starts.

Important

Red Hat recommends to use the auto-tuning settings. Do not set the entry cache size manually.

6.1.1. Manually Re-enabling the Database and Entry Cache Auto-sizing

If you upgraded the instance from a version prior to 10.1.1, or previously manually set an entry cache size, you can enable the auto-tuning for the entry cache.
The following parameters in the cn=config,cn=ldbm database,cn=plugins,cn=config entry control the auto-sizing:
nsslapd-cache-autosize
This settings controls if auto-sizing is enabled for the database and entry cache. Auto-sizing is enabled:
  • For both the database and entry cache, if the nsslapd-cache-autosize parameter is set to a value greater than 0.
  • For the database cache, if the nsslapd-cache-autosize and nsslapd-dbcachesize parameters are set to 0.
  • For the entry cache, if the nsslapd-cache-autosize and nsslapd-cachememsize parameters are set to 0.
nsslapd-cache-autosize-split
The value sets the percentage of RAM that is used for the database cache. The remaining percentage is used for the entry cache.
Using more than 1.5 GB RAM for the database cache does not improve the performance. Therefore, Directory Server limits the database cache 1.5 GB.
To enable the database and entry cache auto-sizing:
  1. Stop the Directory Server instance:
    # systemctl stop dirsrv@instance_name
  2. Backup the /etc/dirsrv/slapd-instance_name/dse.ldif file:
    # cp /etc/dirsrv/slapd-instance_name/dse.ldif \
         /etc/dirsrv/slapd-instance_name/dse.ldif.bak.$(date "+%F_%H-%M-%S")
  3. Edit the /etc/dirsrv/slapd-instance_name/dse.ldif file:
    1. Set the percentage of free system RAM to use for the database and entry cache. For example, to set 10%:
      nsslapd-cache-autosize: 10

      Note

      If you set the nsslapd-cache-autosize parameter to 0, you must additionally set:
      • the nsslapd-dbcachesize in the cn=config,cn=ldbm database,cn=plugins,cn=config entry to 0 to enable the auto-sized database cache.
      • the nsslapd-cachememsize in the cn=database_name,cn=ldbm database,cn=plugins,cn=config entry to 0 to enable the auto-sized entry cache for a database.
    2. Optionally, set the percentage used from the free system RAM for the database cache. For example, to set 40%:
      nsslapd-cache-autosize-split: 40
      Directory Server uses the remaining 60% of free memory for the entry cache.
    3. Save the changes.
  4. Start the Directory Server instance:
    # systemctl start dirsrv@instance_name

Example 6.1. The nsslapd-cache-autosize and nsslapd-cache-autosize-split Parameter

The following settings are the default values for the parameters:
nsslapd-cache-autosize: 25
nsslapd-cache-autosize-split: 25
nsslapd-dbcachesize: 1536MB
Using these settings, 25% of the system's free RAM is used (nsslapd-cache-autosize). From this memory, 25% are used for the database cache (nsslapd-cache-autosize-split) and the remaining 75% for the entry cache.
Depending on the free RAM, this results in the following cache sizes:
GB of Free RAM
Database Cache Size
Entry Cache Size
1 GB
64 MB
192 MB
2 GB
128 MB
384 MB
4 GB
256 MB
768 MB
8 GB
512 MB
1,536 MB
16 GB
1,024 MB
3,072 MB
32 GB
1,536 MB
6,656 MB
64 GB
1,536 MB
14,848 MB
128 GB
1,536 MB
31,232 MB