473,473 Members | 1,502 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

DirectorySearcher first access speed

I have always been under the impression that LDAP was optimized for
speed. Fast queries, fast access, slower writes. I have a block of data
in LDAP and in SQL. Exact same data. The query is fast but the first
access to the result set takes longer that to do the query in SQL and
process the sql results.

From my trace.axd
LDAP Test Starting Search 0.000112 0.000043
LDAP Test Done Search 0.003821 0.003374 <--- fast query at .003 sec
LDAP Test Build XML Doc 0.003906 0.000086
LDAP Test For Loop 0.461937 0.458031 <-- The top of the for loop
Trace.Write(Name, "Build XML Doc");
for(int i=0; i<Results.Count; i++)
{
Trace.Write(Name, "For Loop");
.....

I have traced this down to the 'Results.Count' code. If I loop through
it in some other way then the first access into the search results then
takes the nasty hit. No matter what the access is, (the count or a
single property on a SearchResult object). I have re-arranged the loop
that goes through this result set a couple of different ways and
whatever does the first access into the data takes the at least a .44
sec hit.

Does anyone know what I am doing wrong?

-Cam
Nov 18 '05 #1
6 3524
actually LDAP is fast lightweight protocol for talking to a directory
service. this does not imply the directory service is fast. if you are
quering an active directory service, you may have performance problems
unless the AD has been tuned.

-- bruce (sqlwork.com)

"cameron" <ca****************@appdepot.com> wrote in message
news:uL**************@TK2MSFTNGP12.phx.gbl...
| I have always been under the impression that LDAP was optimized for
| speed. Fast queries, fast access, slower writes. I have a block of data
| in LDAP and in SQL. Exact same data. The query is fast but the first
| access to the result set takes longer that to do the query in SQL and
| process the sql results.
|
| From my trace.axd
| LDAP Test Starting Search 0.000112 0.000043
| LDAP Test Done Search 0.003821 0.003374 <--- fast query at .003 sec
| LDAP Test Build XML Doc 0.003906 0.000086
| LDAP Test For Loop 0.461937 0.458031 <-- The top of the for loop
|
|
| Trace.Write(Name, "Build XML Doc");
| for(int i=0; i<Results.Count; i++)
| {
| Trace.Write(Name, "For Loop");
| ....
|
| I have traced this down to the 'Results.Count' code. If I loop through
| it in some other way then the first access into the search results then
| takes the nasty hit. No matter what the access is, (the count or a
| single property on a SearchResult object). I have re-arranged the loop
| that goes through this result set a couple of different ways and
| whatever does the first access into the data takes the at least a .44
| sec hit.
|
| Does anyone know what I am doing wrong?
|
| -Cam
Nov 18 '05 #2
Tune Active Directory.... Do you have any resources/links on how to do that?

-Cam

bruce barker wrote:
actually LDAP is fast lightweight protocol for talking to a directory
service. this does not imply the directory service is fast. if you are
quering an active directory service, you may have performance problems
unless the AD has been tuned.

-- bruce (sqlwork.com)

"cameron" <ca****************@appdepot.com> wrote in message
news:uL**************@TK2MSFTNGP12.phx.gbl...
| I have always been under the impression that LDAP was optimized for
| speed. Fast queries, fast access, slower writes. I have a block of data
| in LDAP and in SQL. Exact same data. The query is fast but the first
| access to the result set takes longer that to do the query in SQL and
| process the sql results.
|
| From my trace.axd
| LDAP Test Starting Search 0.000112 0.000043
| LDAP Test Done Search 0.003821 0.003374 <--- fast query at .003 sec
| LDAP Test Build XML Doc 0.003906 0.000086
| LDAP Test For Loop 0.461937 0.458031 <-- The top of the for loop
|
|
| Trace.Write(Name, "Build XML Doc");
| for(int i=0; i<Results.Count; i++)
| {
| Trace.Write(Name, "For Loop");
| ....
|
| I have traced this down to the 'Results.Count' code. If I loop through
| it in some other way then the first access into the search results then
| takes the nasty hit. No matter what the access is, (the count or a
| single property on a SearchResult object). I have re-arranged the loop
| that goes through this result set a couple of different ways and
| whatever does the first access into the data takes the at least a .44
| sec hit.
|
| Does anyone know what I am doing wrong?
|
| -Cam

Nov 18 '05 #3
try google, also there are training courses and books on this topic.

-- bruce (sqlwork.com)
"cameron" <ca****************@appdepot.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
| Tune Active Directory.... Do you have any resources/links on how to do
that?
|
| -Cam
|
| bruce barker wrote:
|
| > actually LDAP is fast lightweight protocol for talking to a directory
| > service. this does not imply the directory service is fast. if you are
| > quering an active directory service, you may have performance problems
| > unless the AD has been tuned.
| >
| > -- bruce (sqlwork.com)
| >
| >
| >
| > "cameron" <ca****************@appdepot.com> wrote in message
| > news:uL**************@TK2MSFTNGP12.phx.gbl...
| > | I have always been under the impression that LDAP was optimized for
| > | speed. Fast queries, fast access, slower writes. I have a block of
data
| > | in LDAP and in SQL. Exact same data. The query is fast but the first
| > | access to the result set takes longer that to do the query in SQL and
| > | process the sql results.
| > |
| > | From my trace.axd
| > | LDAP Test Starting Search 0.000112 0.000043
| > | LDAP Test Done Search 0.003821 0.003374 <--- fast query at .003 sec
| > | LDAP Test Build XML Doc 0.003906 0.000086
| > | LDAP Test For Loop 0.461937 0.458031 <-- The top of the for loop
| > |
| > |
| > | Trace.Write(Name, "Build XML Doc");
| > | for(int i=0; i<Results.Count; i++)
| > | {
| > | Trace.Write(Name, "For Loop");
| > | ....
| > |
| > | I have traced this down to the 'Results.Count' code. If I loop through
| > | it in some other way then the first access into the search results
then
| > | takes the nasty hit. No matter what the access is, (the count or a
| > | single property on a SearchResult object). I have re-arranged the
loop
| > | that goes through this result set a couple of different ways and
| > | whatever does the first access into the data takes the at least a .44
| > | sec hit.
| > |
| > | Does anyone know what I am doing wrong?
| > |
| > | -Cam
| >
| >
Nov 18 '05 #4
How large your tree is?
What object you are looking for?
What scope you are searching at?
What search condition you used?

The search depends on your whole AD tree, if the tree is too large, and you
also want to search all, then it shall be slow. After the first search, the
related informaiton is cached, then the sebsequent search should be faster.
But if you specify small cache setting, it will also effect your subsequent
searches.
Best regards,
Rhett Gong [MSFT]
Microsoft Online Partner Support

This posting is provided "AS IS" with no warranties, and confers no rights.
Please reply to newsgroups only. Thanks.

Nov 18 '05 #5
I am searching in just a branch of the tree. The entire tree is fairly
large, (a couple million objects I would guess). I am searching for one
of our custom objects. Scope is onelevel and the search condition is
very, very specific.

Since the it is a onelevel search starting a specific point with a very
specific filter I would expect the search to be quick, which it is (<
0.003 of a second), and the result to be small, which it is, (40
objects), what I don't understand is why the access to the first object
in that search result collection is so slow, (.4 of a second). The size
of the tree, the object type and the scope of the search seem irrelevant
at this point since the actual searching is already complete.

I have stopped using the SearchResultCollection.Count attribute since it
not actually an attribute, it is calculated, (by looping through the
entire collection and couting the number of objects in the collection),
which means if you use it in a for loop to loop through your results
that you are actually looping through the results twice. I am also
avoiding all calculated attributes, (cn, distinguishedName... etc).

Subsquent searches behave exactly the same. No speed increase in
accessing the first object.
Rhett Gong [MSFT] wrote:
How large your tree is?
What object you are looking for?
What scope you are searching at?
What search condition you used?

The search depends on your whole AD tree, if the tree is too large, and you
also want to search all, then it shall be slow. After the first search, the
related informaiton is cached, then the sebsequent search should be faster.
But if you specify small cache setting, it will also effect your subsequent
searches.
Best regards,
Rhett Gong [MSFT]
Microsoft Online Partner Support

This posting is provided "AS IS" with no warranties, and confers no rights.
Please reply to newsgroups only. Thanks.

Nov 18 '05 #6
Hi Cameron,
I agree with the answer from Willy Denoyette.
Please read his suggestion in your post of csharp queue, and we will follow
up you there.

Thanks,
Rhett Gong [MSFT]
Microsoft Online Partner Support

This posting is provided "AS IS" with no warranties, and confers no rights.
Please reply to newsgroups only. Thanks.

Nov 18 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Jayant Sane | last post by:
I am trying to search a user object that is located in a domain that is sub-ordinate to the one from where I begin my search. For eg. I have the domains as DC=corp,DC=company,DC=com and...
3
by: Zeno Lee | last post by:
I'm trying to authenticate a user against a windows network. I want it to work across any kind of windows network from NT 4.0 up to Windows 2003 ADS. So far I've been using DirectoryEntry and...
3
by: cameron | last post by:
I would like to do a search and have the results sorted by property 1 and then by property 2. My first thought had been //set up the searching object and call it oSearch...
2
by: Jason S | last post by:
Group, I'm hoping someone can shed some light on active directory search pagination for me. For the DirectorySearcher class there are several methods for paging (.PageSize,...
5
by: Dave | last post by:
Hi All C# ADSI samples that I run cause unspecified errors. If I translate them into VB.NET they run fine. Here's an example: public string getEmail(string LDAPPath, string username) {...
4
by: cameron | last post by:
I have always been under the impression that LDAP was optimized for speed. Fast queries, fast access, slower writes. I have a block of data in LDAP and in SQL. Exact same data. The query is fast...
1
by: Jay | last post by:
I need to add a parameter to a directorysearcher.filter rather than using hard-coded text. I have the following code that finds all members of an AD group and then for each of those results tries...
0
by: Shaun via .NET 247 | last post by:
Hi there, I have a problem with System.DirectoryServices.DirectorySearcher . I have a VB.Net Web Application containing a web form which has on it a text box, a list box and a button. The form...
1
by: =?Utf-8?B?TGFtaXM=?= | last post by:
Hi, I have this code sample in my window application project : DirectorySearcher mySearcher = new DirectorySearcher("(CN=WMLIN2)"); foreach( SearchResult resEnt in mySearcher.FindAll()) and it...
2
by: Jim in Arizona | last post by:
I'm trying to do a check to see if a specific active directory user account exists in active directory AND a specific group. I can't seem to get the filter down right. I can do this to find a...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.