On all version the dereferencing aliases is works very fast when we have about 2000 aliases and about 200000 entries in the Database. When we add additional 2000 aliases each search with aliases dereferencing hangs for 3 second. When we add additional 2000 (so 6000 alieases in DB) the search time increase for next 3 seconds.
I.E. search time for filter objectclass=user with -a always for:
And this search time was increase even if we add additional 2000 aliases outside the search base dn. We observed that during this 3, 6 second hangs one CPU core is about 100%, system does not wait for resources, memory is on the same level.
In the log I saw that slapd very fast dereferencing all aliases in subtree, hang for 3,6,9 seconds depends of aliases count and after that I saw:
mdb_dn2entry("cn=.....")
Sep 4 14:53:50 ds1 slapd[4280]: => mdb_dn2id("cn=....")
Sep 4 14:53:50 ds1 slapd[4280]: <= mdb_dn2id: got id=0x231
Sep 4 14:53:50 ds1 slapd[4280]: => mdb_entry_decode:
Sep 4 14:53:50 ds1 slapd[4280]: <= mdb_entry_decode
Sep 4 14:53:50 ds1 slapd[4280]: => mdb_filter_candidates
Sep 4 14:53:50 ds1 slapd[4280]: #011OR
Sep 4 14:53:50 ds1 slapd[4280]: => mdb_list_candidates 0xa1
Sep 4 14:53:50 ds1 slapd[4280]: => mdb_filter_candidates
Sep 4 14:53:50 ds1 slapd[4280]: #011EQUALITY
Sep 4 14:53:50 ds1 slapd[4280]: => mdb_equality_candidates (objectClass)
Sep 4 14:53:50 ds1 slapd[4280]: => key_read
Sep 4 14:53:50 ds1 slapd[4280]: <= mdb_index_read: failed (-30798)
Sep 4 14:53:50 ds1 slapd[4280]: <= mdb_equality_candidates: id=0, first=0, last=0
Sep 4 14:53:50 ds1 slapd[4280]: <= mdb_filter_candidates: id=0 first=0 last=0
Sep 4 14:53:50 ds1 slapd[4280]: => mdb_filter_candidates
Sep 4 14:53:50 ds1 slapd[4280]: #011EQUALITY
Sep 4 14:53:50 ds1 slapd[4280]: => mdb_equality_candidates (objectClass)
Sep 4 14:53:50 ds1 slapd[4280]: => key_read
Sep 4 14:53:50 ds1 slapd[4280]: <= mdb_index_read 3585 candidates
Sep 4 14:53:50 ds1 slapd[4280]: <= mdb_equality_candidates: id=3585, first=18960, last=239706
Sep 4 14:53:50 ds1 slapd[4280]: <= mdb_filter_candidates: id=3585 first=18960 last=239706
Sep 4 14:53:50 ds1 slapd[4280]: <= mdb_list_candidates: id=3585 first=18960 last=239706
Sep 4 14:53:50 ds1 slapd[4280]: <= mdb_filter_candidates: id=3585 first=18960 last=239706
Sep 4 14:53:50 ds1 slapd[4280]: mdb_search_candidates: id=3585 first=18960 last=239706
Sep 4 14:53:50 ds1 slapd[4280]: => mdb_entry_decode:
Sep 4 14:53:50 ds1 slapd[4280]: <= mdb_entry_decode
Sep 4 14:53:50 ds1 slapd[4280]: => test_filter
Sep 4 14:53:50 ds1 slapd[4280]: EQUALITY
Sep 4 14:53:50 ds1 slapd[4280]: => access_allowed: search access to "cn......." "objectClass" requested
Sep 4 14:53:50 ds1 slapd[4280]: <= root access granted