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

Directory Server can automatically determine the optimized size for the database and entry cache. In instances created using Directory Server 10.1.1 or later, auto-sizing is enabled by default. Auto-sizing optimizes the size of both caches based on the hardware resources of the server when the instance starts.
If you upgraded from a version earier than 10.1.1 or if you manually set a database or entry cache size, re-enable auto-sizing for optimized performance. For details, see Section 6.1.1, “Manually Re-enabling the Database and Entry Cache Auto-sizing”.

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.
More than 512 MB RAM database cache do not improve the performance. Therefore, the database cache is limited to 512 MB.
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 for both parameters:
nsslapd-cache-autosize: 10
nsslapd-cache-autosize-split: 40
Using these settings, 10% of the system's free RAM is used (nsslapd-cache-autosize). From this memory, 40% are used for the database cache (nsslapd-cache-autosize-split) and the remaining 60% 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
40 MB
62 MB
2 GB
82 MB
122 MB
4 GB
164 MB
245 MB
8 GB
328 MB
492 MB
16 GB
512 MB [a]
1,126 MB
32 GB
512 MB [a]
2,764 MB
64 GB
512 MB [a]
6,042 MB
128 GB
512 MB [a]
12,596 MB
[a] Directory Server applies the 512 MB limit for the nsslapd-dbcachesize parameter.