Skip to content

perf: optimise AD schema discovery to batch attribute lookups #433

@JayVDZ

Description

@JayVDZ

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.csGetAdSchemaAttribute(), 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    performancePerformance optimisation work

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions