-
Notifications
You must be signed in to change notification settings - Fork 0
perf: optimise AD schema discovery to batch attribute lookups #433
Description
Summary
The AD schema discovery path in LdapConnectorSchema.GetActiveDirectorySchemaAsync() currently queries individual attributeSchema objects one-by-one via GetSchemaEntry() for every attribute on every object class. This results in N+1 LDAP queries (one per class + one per attribute).
Proposed Optimisation
Fetch all attributeSchema objects in a single LDAP search against the schema partition and build an in-memory lookup dictionary, then resolve attributes from the dictionary instead of making individual LDAP queries. This would reduce the query count from hundreds/thousands to ~3 (schema partition DN, all classSchema entries, all attributeSchema entries).
The RFC 4512 path (OpenLDAP/Generic) already works this way — it reads the entire schema in 2 queries (rootDSE + subschema subentry).
Files
src/JIM.Connectors/LDAP/LdapConnectorSchema.cs—GetAdSchemaAttribute(),AddObjectTypeAttributes(),GetObjectClassAttributesRecursively()
Context
Identified during #72 Phase 4 Step 3 (RFC 4512 schema discovery implementation). Not blocking OpenLDAP support — this is a standalone performance improvement for AD/Samba AD connected systems.