Chapter 4. Tuning the number of BDB locks When a Directory Server instance uses Berkeley Database (BDB), lock mechanism controls how many copies of Directory Server processes can run at the same time. For example, during an import job, Directory Server sets a lock in the /run/lock/dirsrv/slapd-instance_name/imports/ directory to prevent the ns-slapd Directory Server process, another import, or export operations from running. If the server runs out of available locks, Directory Server logs the following error in the /var/log/dirsrv/slapd-instance_name/errors file: libdb: Lock table is out of available locks However, the Directory Server default settings try to prevent the server from running out of locks to avoid data corruption. For details, see Avoiding data corruption by monitoring free database locks 4.1. Avoiding data corruption by monitoring free BDB database locks Running out of Berkeley Database (BDB) locks can lead to data corruption. To avoid this, Directory Server, by default, monitors the remaining number of free locks every 500 milliseconds and, if the number of active database locks is equal or higher than the 90%, Directory Server stops all searches. The following procedure changes the interval to 600 milliseconds and the threshold to 85 percent. Note If you set a too high interval, the server can run out of locks before the monitoring check happens. Setting a too short interval can slow down the server. Prerequisites The Directory Server instance uses BDB. Procedure Set the interval and threshold: Restart the instance: Verification Display the locks monitoring settings: 4.2. Manually monitoring the number of BDB locks Directory Server tracks the current number of Berkeley Database (BDB) locks in the nsslapd-db-current-locks and nsslapd-db-max-locks attributes in cn=database,cn=monitor,cn=ldbm database,cn=plugins,cn=config . Prerequisites The Directory Server instance uses BDB. Procedure To display the number of locks, enter: # ldapsearch -D " cn=Directory Manager " -W -H ldap://server.example.com -x -s sub -b "cn=database,cn=monitor,cn=ldbm database,cn=plugins,cn=config" nsslapd-db-current-locks nsslapd-db-max-locks ... nsslapd-db-current-locks: 37 nsslapd-db-max-locks: 39 4.3. Setting the number of BDB locks using the command line Use the dsconf backend config set command to update the number of Berkeley Database (BDB) locks that Directory Server can use. Prerequisites The Directory Server instance uses BDB. Procedure Set the number of locks: The command sets the number of locks to 20000 . Restart the instance: Verification Display the value of the nsslapd-db-locks parameter: 4.4. Setting the number of BDB locks using the web console You can set the number of Berkeley Database (BDB) locks that Directory Server uses in the global database configuration in the web console. Prerequisites You are logged in to the instance in the web console. The Directory Server instance uses BDB. The following procedure sets the number of locks to 2000 . Procedure Navigate to Database Global Database Configuration Database Locks . Update the Database Locks field to 2000 . Click Save Config . Click Actions Restart Instance . Verification Verify that the new value is present in Database Global Database Configuration Database Locks .

Commands:
libdb: Lock table is out of available locks
dsconf instance_name backend config set --locks-monitoring-enabled on --locks-monitoring-pause 600 --locks-monitoring-threshold 85
dsctl instance_name restart
dsconf -D " cn=Directory Manager " ldap://supplier.example.com backend config get | grep "nsslapd-db-locks-monitoring" nsslapd-db-locks-monitoring-enabled: on nsslapd-db-locks-monitoring-threshold: 85 nsslapd-db-locks-monitoring-pause: 600
ldapsearch -D " cn=Directory Manager " -W -H ldap://server.example.com -x -s sub -b "cn=database,cn=monitor,cn=ldbm database,cn=plugins,cn=config" nsslapd-db-current-locks nsslapd-db-max-locks nsslapd-db-current-locks: 37 nsslapd-db-max-locks: 39
dsconf instance_name backend config set --locks= 20000
dsctl instance_name restart
dsconf instance_name backend config get | grep "nsslapd-db-locks:" nsslapd-db-locks: 20000