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

Thorsten Kampe thorsten at thorstenkampe.de
Tue May 17 15:50:47 CEST 2011


* Michael Ströder (2011-05-17 14:40 +0200)
> Thorsten Kampe wrote:
> So in which part of the code can the time difference be observed?

# "1.1" means "no attributes"
result = connection.search_s(base, ldap.SCOPE_SUBTREE, attrlist = ['1.1'], attrsonly = True)

(as already mentioned)
 
> 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 --------------------------------

That did not output anything, but when setting just trace_level 2, I get:
# eDirectory case
*** ldap://windows2008r2:390 - SimpleLDAPObject.set_option ((17, 3),{})
*** ldap://windows2008r2:390 - SimpleLDAPObject.simple_bind (('', '', None, None),{})
=> result: 1
*** ldap://windows2008r2:390 - SimpleLDAPObject.result3 ((1, 1, -1),{})
=> result: (97, [], 1, [])
*** ldap://windows2008r2:390 - SimpleLDAPObject.search_ext (('', 2, '(objectClass=*)', ['1.1'], 0, None, None, -1, 0),{})
=> result: 2
*** ldap://windows2008r2:390 - SimpleLDAPObject.result3 ((2, 1, -1),{})
!! actual output; no delay
*** ldap://windows2008r2:50385 - SimpleLDAPObject.unbind_ext ((None, None),{})

# Active Directory case
*** ldap://windows2008r2:50385 - SimpleLDAPObject.set_option ((17, 3),{})
*** ldap://windows2008r2:50385 - SimpleLDAPObject.simple_bind (('CONTOSO\\admin', 'password', None, None),{})
=> result: 1
*** ldap://windows2008r2:50385 - SimpleLDAPObject.result3 ((1, 1, -1),{})
=> result: (97, [], 1, [])
*** ldap://windows2008r2:50385 - SimpleLDAPObject.search_ext (('dc=contoso,dc=com', 2, '(objectClass=*)', ['1.1'], 0, None, None, -1, 0),{})
=> result: 2
*** ldap://windows2008r2:50385 - SimpleLDAPObject.result3 ((2, 1, -1),{})
!! 40 seconds later:
!! actual output
*** ldap://windows2008r2:50385 - SimpleLDAPObject.unbind_ext ((None, None),{})

Thorsten


More information about the python-ldap mailing list