Quantcast
Channel: .NET Framework Class Libraries forum
Viewing all articles
Browse latest Browse all 8156

SOLVED: System.DirectoryServices.SearchResultCollection Horrendously slow: 5 seconds per entry

$
0
0

EDIT: Problem with my code.  The epiphany came when I viewed a forum I cannot link to because of my account status: forums.asp.net/post/1240890.aspx

I was incorrectly calling GetDirectoryEntry when I was moving through my attributes.

ORIGINAL POST:

This may not be the  correct forum, but it was my best guess as a place to start.

I'm working with a non-A/D ldap server (IBM Domino).  I create a SearchResultCollection object and do a search.  This search result is going to be large, as in a few hundred results, but I'm finding similar per-result numbers even if the search returns one entry.

It's taking around 5-6 seconds to get a result, and that after I played with optimization as much as I can to bring it down to there.

I've done some packet sniffing and I believe the issue is in how the DirectoryServices is interacting with an ldap server.

So, I modified my code to return one result and packet sniffed.

Within .06 seconds, DirectoryServices had bound to the ldap server and issued the search request that would return the one object. Within .01 seconds, the ldap server had returned a response.  (I did notice that the response was not limited to the PropertiesToLoad collection I had passed to the SearchResultCollection, but the timing is still good).

For the next .45 seconds, DirectoryServices queried for the timestamp attribute on "cn=schema" over 30 times.  Note:  That timestamp value hasn't changed in over two years, let alone any time during that .45 seconds.

Then, it proceeded to run the original query that returns one result again.

This pattern of multiple queries for the schema timestamp and requery the original query repeated a total of 10 times for a total elapsed time of about 4.9 seconds.

I'm using Visual Studio 2012 with .Net 4.0.  System.DirectoryServices is specifically version 4.0.30319.17929.

I'm hoping there are some obscure properties I can change from the default that will help here.

Any help or thoughts are appreciated.

If this is not the correct forum, I'd appreciate suggestions where this should go.




Viewing all articles
Browse latest Browse all 8156

Trending Articles