[Date Prev][Date Next] [Chronological] [Thread] [Top]

Tuning BerkeleyDB

Just a bit of an FYI for folks using OpenLDAP with BerkeleyDB on a multi-processor machine - there's some pretty useful hints here
starting with the section "mutex selection." (The information in the previous sections is already accounted for in the back-bdb code and will seldom need adjusting.) You may need to re-configure and rebuild BerkeleyDB to get the best DB mutex performance on your system. Also, the docs are a bit deceptive regarding the DB_ENV->set_tas_spins method:
The spin count is used even when you're using POSIX pthread mutexes, and the default value used on multi-processor machines makes BDB extremely slow as the number of active threads increases. The default on a uni-processor machine is 1; our testing shows that setting it to 1 on a multi-processor machine works much better as well. With POSIX mutexes I don't see any reason to spin at all, it should be set to 0 regardless of the number of CPUs.

If you're running a Linux kernel up to 2.4 you're probably using LinuxThreads; since LinuxThreads didn't support interprocess mutexes BDB would probably have defaulted to using test-and-set mutexes. If you're on 2.6 with NPTL it would most likely default to using POSIX mutexes. It's worth double-checking your BerkeleyDB build to see exactly how it was configured.

 -- Howard Chu
 Chief Architect, Symas Corp.  http://www.symas.com
 Director, Highland Sun        http://highlandsun.com/hyc
 OpenLDAP Core Team            http://www.openldap.org/project/