Menu Close
Settings Close

Language and Page Formatting Options

Chapter 4. Tuning the number of locks

Lock mechanisms in Directory Server control 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 database locks

Running out of database locks can lead to data corruption. To avoid this, Directory Server, by default, monitors the remaining number of free database locks every 500 milliseconds and, if the number of active database locks is equal or higher than the 90%, Directory Server aborts all searches.

This 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 next monitoring check happens. Setting a too short interval can slow down the server.

Procedure

  1. Set the interval and threshold:

    # dsconf -D "cn=Directory Manager" ldap://server.example.com backend config set --locks-monitoring-enabled on --locks-monitoring-pause 600 --locks-monitoring-threshold 85
  2. Restart the instance:

    # dsctl instance_name restart

Verification

  • Display the locks monitoring settings:

    # 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

4.2. Manually monitoring the number of locks

Directory Server tracks the current number of 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.

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 locks using the command line

Use the dsconf backend config set command to update the number of locks Directory Server can use.

Procedure

  1. Set the number of locks:

    # dsconf -D "cn=Directory Manager" ldap://server.example.com backend config set --locks=20000

    This command sets the number of locks to 20000.

  2. Restart the instance:

    # dsctl instance_name restart

Verification

  • Display the value of the nsslapd-db-locks parameter:

    # dsconf -D "cn=Directory Manager" ldap://supplier.example.com backend config get | grep "nsslapd-db-locks:"
    nsslapd-db-locks: 20000

4.4. Setting the number of locks using the web console

You can set the number of locks Directory Server uses in the global database configuration in the web console.

Prerequisites

  • You are logged in to the instance in the web console.

Procedure

  1. Navigate to DatabaseGlobal Database Configuration.
  2. Click Show Advanced Settings.
  3. Select Enable Monitoring, and enter the threshold percentage and pause milliseconds.
  4. Click Save Config.
  5. Click ActionsRestart Instance.

Verification

  1. Navigate to DatabaseGlobal Database Configuration.
  2. Click Show Advanced Settings.
  3. Verify if the lock monitoring settings.