Managing the Locking Subsystem
Prev | Chapter 3. Configuring the Berkeley DB SQL interface | Next

## Managing the Locking Subsystem

Whenever the BDB SQL interface reads from or writes to the database, the underlying Berkeley DB code must acquire locks. These locks represent a finite resource. For most installations, you should never have to worry about the locking resources available to Berkeley DB because the default values are appropriate for most applications.

However, if your application is using an extremely large number of threads that are all simultaneously accessing your data, then you might have to increase your locking resources. Similarly, if your database contains a very large number of tables that you are accessing using one or more simultaneous threads or processes, then you might also need to increase your locking resources.

On the other hand, if you are using the BDB SQL interface on devices with extremely limited resources, then you might want to reduce your locking resources.

All of these values must be configured before your environment is first created. To change these values after environment creation time, you must re-create the environment. See The DB_CONFIG File for more information.

The maximum locking values that you can manage, and the `DB_CONFIG` parameter that you use to manage that value, are:

- The maximum number of lockers supported by the environment. This value is used by the environment when it is opened to estimate the amount of space that it should allocate for various internal data structures. By default, 2,000 lockers are supported.

  The maximum number of lockers corresponds roughly to the maximum number of concurrent transactions in the system.

  To configure this value, use the `set_lk_max_lockers` DB_CONFIG parameter. See the Berkeley DB C API for details.

- The maximum number of locks supported by the environment. By default, 10,000 locks are supported.

  To configure this value, use the `set_lk_max_locks` DB_CONFIG parameter. See the Berkeley DB C API for details.

- The maximum number of locked objects supported by the environment. By default, 10,000 objects can be locked.

  To configure this value, use the `set_lk_max_objects` DB_CONFIG parameter. See the Berkeley DB C API for details.

Note that when you are using the BDB SQL interface, the default values provided in the previous list are different from the default values used by Berkeley DB in general. For Berkeley DB in general, the defaults for all these values are set to 1,000.

Prev | Up | Next
Administering Log Files | Home | Chapter 4. Administrating Berkeley DB SQL Databases