20040922 tuning the berkeley db - plembo/onemoretech GitHub Wiki

title: Tuning the Berkeley DB link: https://onemoretech.wordpress.com/2004/09/22/tuning-the-berkeley-db/ author: lembobro description: post_id: 761 created: 2004/09/22 02:48:00 created_gmt: 2004/09/22 02:48:00 comment_status: open post_name: tuning-the-berkeley-db status: publish post_type: post

Tuning the Berkeley DB

Sleepycat Software’s Berkeley DB is the most widely used embedded database manager in the world. The latest release of OpenLDAP (v2.2x) uses Berkeley DB (v2.4x) for it’s bdb backend.

Note: Sleepycat and BDB were purchased by Oracle in February 2007. While BDB remains freely available as open source software, more than a few have wondered about its future. Some companies, like MySQL AB, are dropping support for it. Ironically, Sun and Red Hat also depend upon a modified version of BDB for their directory databases. The Berkeley DB product site is now hosted on oracle.com.

With the original OpenLDAP ldbm backend, database tuning was all done inside the slapd.conf file. Limited configuration of the bdb backend can still be done in slapd.conf, but fine tuning now needs to be done in the standard DB_CONFIG file usually found in the directory specified in slapd.conf by the database section’s directory directive (e.g. /var/db/openldap-data).

Right now I’m still experimenting with DB_CONFIG, so my configuration is fairly simple. I got the basic framework from the OpenLDAP FAQ on the subject. Of course to make it effective I’m going to have to rebuild my 10,000 entry test database, but hey, who needs to break for lunch anyway? I’m setting the cache initially at 64 Mb, to see if this gets me around a bulk loading problem I had during a recent db creation session (I wound up using slapadd to complete the process). Here’s the config I’m going to use:

# Set the database in memory cache size.  
#  
set_cachesize 0 64000000 0  
#  
# Set database flags.  
# (for database loading/reindexing)  
# set_flags DB_TXN_NOSYNC  
#  
# Set log values.  
#  
# set_lg_regionmax 1048576  
# set_lg_max 10485760  
# set_lg_bsize 2097152  
# set_lg_dir /usr/local/var/openldap-logs`

Late Note: I used this config with my test db as planned, and it did in fact get me past the bulk loading issue I’d been experiencing with OpenLDAP 2.2, working directly with the db config has been a real eye-openner and would make a great chapter in a book someday.

Copyright 2004-2019 Phil Lembo