【发布时间】:2021-09-21 07:40:51
【问题描述】:
我有一个要求,我需要运行如下查询并为满足此查询的所有实体获取 2-3 个属性。在单个查询中,distinguishedName 的数量约为 100。正如我在 microsoft documentation 中看到的那样,该 distinctName 没有被索引,我怀疑这可能会导致性能问题。
有谁知道这是否确实会导致性能问题?除了下面的 ldap 过滤器,我显然必须使用 SUBTREE 范围。
(|(distinguishedName=<DN 1 goes here>)(distinguishedName=<DN 2 goes here>))
编辑 1: 我在我的测试 Active Directory 中尝试了这个,它有大约 6k 个条目。
Internal event: A client issued a search operation with the following options.
Starting node:
DC=example,DC=com
Filter:
( |
(distinguishedName=CN=user-1,CN=large-test,CN=Users,DC=example,DC=com)
(distinguishedName=CN=user-2,CN=large-test,CN=Users,DC=example,DC=com)
(distinguishedName=CN=user-3,CN=large-test,CN=Users,DC=example,DC=com)
(distinguishedName=CN=group1,CN=large-test,CN=Groups,DC=example,DC=com)
)
Search scope:
subtree
Attribute selection:
mail,objectClass
Server controls:
Visited entries:
4
Returned entries:
4
Used indexes:
idx_distinguishedName:4:N;idx_distinguishedName:1:N;idx_distinguishedName:1:N;idx_distinguishedName:1:N;
Pages referenced:
123
Pages read from disk:
0
从结果看来,它只访问了我使用某些索引搜索的 4 个条目。我检查了架构管理单元工具(只是为了确定),它没有在 distinctName 上显示索引。不过不确定它是如何使用这些索引的。
【问题讨论】:
-
你试过什么?您多久运行一次此查询?你是如何执行查询的? (代码?应用程序?JNDI?)
-
我将获取活动目录中的所有组及其成员。我还需要获取会员电子邮件。由于在获取组列表期间,它只返回成员 dn 而不是电子邮件,因此我需要分别获取与这些 DN 对应的电子邮件。由于成员的数量可能很大,因此该查询会经常运行。我们将使用一些 ldap 库(unboundid)通过我们的 java 应用程序运行此查询。
-
distinguishedName属性没有设置索引搜索标志因为它不是真正的属性。老实说,这听起来很像一个想象中的问题。如果你真的很担心:尝试在你的应用程序中实现你的查询逻辑,然后test it against a DC with diagnostic logging enabled -
谢谢马蒂亚斯。我一直在寻找类似的东西,它可以帮助我诊断查询是否有效。我会试试这个。
-
尝试在测试活动目录上运行示例请求并更新了上面的结果。
标签: active-directory ldap ldap-query