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.
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:
- 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. - 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:
- 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.
- Select the instance.
- On the Global Database Configuration.tab, select
- Disable Automatic Cache Tuning.
- Click.
- Set the Database Cache Size (bytes) field to the database cache size.
- Click.
- Click the Restart Instance.button, and select
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:
- Create a directory for the database cache and metadata on the RAM disk:
# mkdir -p /dev/shm/slapd-instance_name/
- Set the following permissions on the directory:
# chown dirsrv:dirsrv /dev/shm/slapd-instance_name/ # chmod 770 /dev/shm/slapd-instance_name/
- Stop the Directory Server instance:
# systemctl stop dirsrv@instance_name
- Edit the
/etc/dirsrv/slapd-instance_name/dse.ldif
file and set the new path in thensslapd-db-home-directory
attribute in thecn=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 thensslapd-db-home-directory
attribute does not exist, add it with the new value to thecn=bdb,cn=config,cn=ldbm database,cn=plugins,cn=config
entry. - 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.