I have a high volume website that creates and destroys an instance of DirectoryEntry for every request, and calls multiple searches using DirectorySearcher.
If the goal is to reduce the perceived load on ActiveDirectory (multiple login events), and to ideally reduce the physical load as well, what object reuse strategy is appropriate for this object?
Some things I'm considering:
What is the simplest way to solve this problem or is there a Factory/Pool pattern I could just plug into via Generics or some simple code editing?
DirectoryEntry
will use connection pooling (reuse connections) as long as there is at least one undisposed DirectoryEntry
for the same context (same domain, and credentials). There is a discussion of that here (note that DirectoryEntry
just wraps the native Windows ADSI interface), here and here .
There are also other ways to increase performance, like making sure you only ask for the attributes you need when you search (use PropertiesToLoad
). I discuss that in more detail in an article I wrote: Active Directory: Better performance
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.