简体   繁体   English

如何在IIS中通过DirectoryEntry减少与AD的连接?

[英]How should I reduce connections to AD with DirectoryEntry within IIS?

I have a high volume website that creates and destroys an instance of DirectoryEntry for every request, and calls multiple searches using DirectorySearcher. 我有一个高流量的网站,它为每个请求创建和销毁DirectoryEntry的实例,并使用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? 如果目标是减少ActiveDirectory上的感知负载(多个登录事件),并且理想情况下还减少物理负载,那么哪种对象重用策略适合该对象?

Some things I'm considering: 我正在考虑的一些事项:

  • Singleton Pattern 单例模式
  • Object Factory (to handle multiple base DNs) 对象工厂(处理多个基本DN)
  • Factory + ObjectPool (to handle load??) Factory + ObjectPool(处理负载?)

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? 解决此问题的最简单方法是什么?是否存在我可以通过泛型或一些简单的代码编辑插入的Factory / Pool模式?

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). 只要同一上下文(相同的域和凭据)至少有一个未处理的DirectoryEntryDirectoryEntry将使用连接池(重用连接)。 There is a discussion of that here (note that DirectoryEntry just wraps the native Windows ADSI interface), here and here . 还有就是一个讨论在这里 (注意DirectoryEntry只是包装的原生Windows ADSI接口), 这里这里

There are also other ways to increase performance, like making sure you only ask for the attributes you need when you search (use PropertiesToLoad ). 还有其他提高性能的方法,例如确保仅在搜索时要求使用所需的属性(使用PropertiesToLoad )。 I discuss that in more detail in an article I wrote: Active Directory: Better performance 我在写的文章中对此进行了详细讨论: Active Directory:更好的性能

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM