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

Re: optimal index for ldap



On Thursday 20 September 2007 14:51:02 Ace wrote:
> On Wednesday 19 September 2007 15:52:02 Ace wrote:
> >> Hi Masters,
> >>
> >> We have around 100000 entries of the form -
> >>
> >> dn: cn=rr1,ou=addressbook,dc=zlemail,dc=com
> >> objectClass: top
> >> objectClass: inetOrgPerson
> >> mail: rr1@oo.com
> >> userPassword: a@123
> >> cn: rr1
> >> sn: rr1
> >>
> >> What should be the index for fast search?
> >
> >As Quanah and Aaron replied, the search filters you use will determine the
> >indexes you need.
> >
> >However, most mail clients will search on the cn, sn, and maybe the mail
> >attribute, so you probable need equality and substring indexes on those 3
> >attributes, plus the standard equality index on objectclass. It is
> > unlikely that you will need to index userPassword.
>
> Ok. I tried having indexes on cn, sn and mail as -
> index default eq
> index cn eq,pres
> index sn eq, pres
> index mail eq,pres
> index objectClass eq
>
> The problem here is when I have index on cn, it didn't finds what I search
> for. Here is search query -
> ldapsearch -x -b "dc=zlemail,dc=com" "(cn=rr1)"

Did you consult the documentation? For instance, please see the section on the 
index directive in the man page for slapd-bdb. It says:

"Note:   changing   index   settings   in
              slapd.conf(5)  requires  rebuilding  indices,  see 
slapindex(8);"

> Now if I remove index on cn, it does finds record but complains about index
> failed on cn. Also it takes considerable amount of time for search
> operation to complete. Do I need to revisit my ldap database structuring?

No, you need to re-index.

> >However, I note that with a relatively large database, your entry cache
> > and backend database cache tuning is also critical to performance.
>
> Yes. I am using cachesize = 1000000 and DB_CONFIG file same as
> DB_CONFIG.example (no changes made)
>
> >If you are seeing high CPU utilisation, check the logs for errors relating
>
> to
>
> >indexes, and add the indexes slapd is complaining are missing. If you have
> >high load average but low CPU utilisation (thus high load due to IO wait),
> >you need to look at your cache tuning.
>
> Its a high CPU utilization. Refer above reply for index problem.
>
> >For anyone to provide more assistance, you need to provide more details on
> >your configuration (OpenLDAP version, backend you are using, any tuning
> > you have done, possibly the sizes of the files in your database
> > directory).
>
> My LDAP version is 2.3.32, bdb backend.

Regards,
Buchan