Red Hat Training

A Red Hat training course is available for Red Hat Directory Server

6.5. Setting the Database Cache Size

The database cache contains the Berkeley database index files for the database, meaning all of the *.db and other files used for attribute indexing by the database. This value is passed to the Berkeley DB API function set_cachesize().
This cache size has less of an impact on Directory Server performance than the entry cache size, but if there is available RAM after the entry cache size is set, increase the amount of memory allocated to the database cache.
The operating system also has a file system cache which may compete with the database cache for RAM usage. Refer to the operating system documentation to find information on file system cache settings and monitoring the file system cache.


Instead of manually setting the entry cache size Red Hat recommends the auto-sizing feature for optimized settings based on the hardware resources. For details, see Section 6.1.1, “Manually Re-enabling the Database and Entry Cache Auto-sizing”.
To manually set the database cache size, you can use:

Directory Server Console: Setting the Database Cache Size

For example, to set the database cache to 256 megabytes:
  1. Start the Directory Server Console.
  2. Select the Configuration tab and, in the navigation tree, expand the Data icon.
  3. Select the Database Settings entry.
  4. In the LMDB Plug-in Settings tab, fill the Maximum cache size field and select the unit.
  5. Click Save.
    The Directory Server Console returns an LDAP_UNWILLING_TO_PERFORM error message when you set:
    • a value that is not a number.
    • a value that is too big for a 32-bit signed integer (2147483647) on a 32-bit system.
    • a value that is too big for a 64-bit signed integer (9223372036854775807) on a 64-bit system.
  6. Restart the Directory Server instance:
    # systemctl restart

Command Line: Setting the Database Cache Size

For example, to set the database cache to 256 megabytes:
  1. Update the value in the Directory Server configuration:
    # ldapmodify -D "cn=Directory Manager" -W -x
    dn: cn=config,cn=ldbm database,cn=plugins,cn=config
    changetype: modify
    replace: nsslapd-dbcachesize
    nsslapd-dbcachesize: 268435456
  2. Restart the Directory Server instance:
    # systemctl restart

6.5.1. Storing the Database Cache on a RAM Disk

If your system running the Directory Server instance has enough free RAM, you can optionally store the database cache on a RAM disk for further performance improvements:
  1. Create a directory for the database cache and metadata on the RAM disk:
    # mkdir -p /dev/shm/slapd-instance_name/
  2. Set the following permissions on the directory:
    # chown dirsrv:dirsrv /dev/shm/slapd-instance_name/
    # chmod 770 /dev/shm/slapd-instance_name/
  3. Stop the Directory Server instance:
    # systemctl stop dirsrv@instance_name
  4. Edit the /etc/dirsrv/slapd-instance_name/dse.ldif file and set the new path in the nsslapd-db-home-directory attribute in the cn=bdb,cn=config,cn=ldbm database,cn=plugins,cn=config entry:
    dn: cn=bdb,cn=config,cn=ldbm database,cn=plugins,cn=config
    nsslapd-db-home-directory: /dev/shm/slapd-instance_name/
    If the nsslapd-db-home-directory attribute does not exist, add it with the new value to the cn=bdb,cn=config,cn=ldbm database,cn=plugins,cn=config entry.
  5. Start the Directory Server instance:
    # systemctl start dirsrv@instance_name


When the database cache is stored on a RAM disk, Directory Server needs to recreate it after each reboot. As a consequence, the service start and initial operations are slower until the cache is recreated.