[python-ldap] Querying Active Directory excessively slower than querying eDirectory

Michael Ströder michael at stroeder.com
Tue May 17 14:40:22 CEST 2011


Thorsten Kampe wrote:
> * Michael Ströder (2011-05-17 14:14 +0200)
>> without knowing more details one cannot really comment on this. Just wild
>> guesses:
>>
>> Something related to DNS?
>>
>> Or referral chasing? (MS AD returns referrals)
>> Did you try to turn off automatic referral chasing?
> 
> It's not a connection issue. As I wrote, the data is returned from both
> DAs within the same second (actually 60 milliseconds).
>  
>> Is the time measured only the call to connection.search_s() or does it
>> include connecting to the server?
> 
> It includes connecting but that is less than one second.
> 
>> Which is the search base? The search filter?
> 
> In the Active Directory case it is the root of the domain partition
> (/dc=conto
> so,dc=com) in the eDirectory case it is the root of the tree. But that
> shouldn't matter since the response with the query data comes within
> sixty milliseconds. The filter is the default ((objectClass=*)).

So in which part of the code can the time difference be observed?

How about running with trace_level=2 and use module logging for a file-like
object. This also writes time-stamps for each logged line.

Example:

-------------------------------- snip --------------------------------
import logging

class logging_file_class:

  def __init__(self,logging_level):
    self._logging_level = logging_level

  def write(self,msg):
    logging.log(self._logging_level,msg[:-1])

ldap.initialize(uri,trace_level=2,trace_file=logging_file_class(logging.DEBUG))
-------------------------------- snip --------------------------------

Ciao, Michael.


More information about the python-ldap mailing list