Search

6.5. Setting the Database Cache Size

download PDF
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.

Note

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

6.5.1. Manually Setting the Database Cache Size Using the Command Line

To manually set the database cache size using the command line:
  1. Disable automatic cache tuning:
    # dsconf -D "cn=Directory Manager" ldap://server.example.com backend config set --cache-autosize=0
    Manually set the database cache size:
    # dsconf -D "cn=Directory Manager" ldap://server.example.com backend config set --dbcachesize=268435456
    This command sets the database cache to 256 megabytes.
  2. Restart the Directory Service instance:
    # dsctl instance_name restart

6.5.2. Manually Setting the Database Cache Size Using the Web Console

To manually set the database cache size using the Web Console:
  1. Open the Directory Server user interface in the web console. For details, see Logging Into Directory Server Using the Web Console section in the Red Hat Directory Server Administration Guide.
  2. Select the instance.
  3. On the Database tab, select Global Database Configuration.
  4. Disable Automatic Cache Tuning.
  5. Click Save Configuration.
  6. Set the Database Cache Size (bytes) field to the database cache size.
  7. Click Save Configuration.
  8. Click the Actions button, and select Restart Instance.

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

Note

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.
Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.