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

speeding up searches (index?)


I recently joined openldap-software and this is my first post to the list. 
Please excuse me if I don't include all the information you might need to
help me (or even to understand me). I'll provide more details if anyone needs

I've got a set of mail servers who's user list is stored in an directory. I
am running 2.0.7 compiled from a source RPM. It's compiled to use GDBM. I've
added a few things to the schema, and everything is working nicely. Here is
an example of a record:

dn: uid=user%customer.com,ou=People,dc=company,dc=com
mailBase: /mnt/mail
objectClass: posixAccount
objectClass: top
gidNumber: 1001
uid: user%customer.com
uidNumber: 1001
associatedDomain: customer.com
cn: Mail Server User
mailDir: c/u/customer.com/user/
userPassword:: Zm9v
homeDirectory: /home/customer.com/user
mail: user@customer.com
autoResponderMsg: testing
mailDirQuota: 10485760

Here is how my indexes are setup in slapd.conf:

# Indices to maintain
index   objectClass,uid,uidNumber,gidNumber,associatedDomain    eq,pres
index   cn,mail,surname,givenname               eq,subinitial

I've run slapindex after every change to these.

The main ldap client is Postfix's LDAP map function. (Postfix is an MTA). I've
got a map that uses the following filter:

ldap_localmail_query_filter = (associatedDomain=%s)
(where %s is the domain, e.g. customer.com)

And it retrieves this from the results:

ldap_localmail_result_attribute = associatedDomain

The problem is that there is a numer of records that match this filter, one
for every account in the domain. For a small domain with only 21 accounts,
it can take many seconds to return from this query. I know this isn't the 
most accurate way to time a query, but if I do:

$ time ldapsearch  -b "dc=company, dc=com" associatedDomain=customer.com associatedDomain

I get the results of the search and:

real    0m7.645s
user    0m0.020s
sys     0m0.000s

Looking at the performance of postfix, this appears to be true. If I could
reduce the number of values expected to just 1 (which is all postfix needs)
maybe it would be faster. Isn't that a client function though?

Thanks for baring with me through this long explaination. I hope someone 
can lead me to a better solution. Please feel free to ask me for more info
if you think it will help.

Joshua Warchol
UNIX Systems Administrator