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.
With the origina 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 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.