new blog 2.0


0x09. [LPIC-301] LDAP - Directory performance tuning

Before we start
Prior to configuring slapd take few factors into consideration.
  • Main memory. It's always a good idea to extend it according to the needs so later you can scale the cache with the cachesize directive.
  • Hard drive. It's a good idea to allocate each database on a separate disk. Of course the faster hard drive you use, the better performance you get.
  • Filesystem tuning. noatime is one of the options you may want to use in /etc/fstab
Start your performance tuning with the index directive in slapd.conf. Generally, indexing entries is supposed to speed up the performance, however, if you index entries you never or vary infrequently search for it will only slow down your directory.

If a search for some specific filter is performed particularly often, slapd can create an index based on the information available in the database. From now on if a user searches the directory the entries are returned based on the index and slapd won't waste its own and users time.
The general syntax for doing indexing with slapd is to add a line (or multiple lines) with the index directive to slapd.conf. The said line is of the following format:

index attr1[,attr2[,...]] index_type1[,index_type2[,...]]

where attrX is an arbitrary attribute, like objectClass, uid, cn, sn etc and index_typeX is one of the four following options:
  • eq - tells slapd to index all searches with an exact match for a particular attribute
  • sub - creates an index with substrings for the given attribute
  • approx - indexes entries with approximate or phonetic value
  • pres - checks for presence. Apparently this type is not very commonly used, as normally the application expects itself, if an attribute is present or not.
slapindex must be run every time you update index section in slapd.conf, otherwise the indexes won't be recreated.

Go to for some more explanation.

Internal database tuning can be achived by modifying DB_CONFIG file, located in the root directory of the database. For detailed information on the file itself please refer to

db4.3_archive, db4.3_deadlock, db4.3_load, db4.3_recover, db4.3_upgrade, db4.3_checkpoint, db4.3_dump, db4.3_printlog, db4.3_stat, db4.3_verify are programs that come with Berkley DB 4.3. and can be used to verify / tune performance on the database itself.

Opulent logging can decrease performance. A simple solution for that is to reduce the logging level to minimum:
# - slapd.conf excerpt -
loglevel 0

No comments: