defect

Jens Vagelpohl jens at zope.com
Tue Jun 25 14:28:15 CEST 2002


i have seen similar strange slowdowns **if i connect to localhost**. 
connecting to OpenLDAP on another host across the network was much faster 
(meaning: it worked at the expected speed). the slowdown never occurred on 
python-ldap 1.10.3. both were compiled against OpenLDAP2-libraries.

so far i tended to assume that the problem might be a local configuration 
issue on my machine, though i haven't been able to find it yet.

jens


On Monday, June 24, 2002, at 10:04 , Derrick 'dman' Hudson wrote:

>
> I tried using python-ldap today (1.9.999.pre04-1, python 2.1.3-3), but
> it is way too inefficient.  A simple search that results in 2 entries
> returned takes 30 seconds.  Watching with top shows nearly 100% CPU
> usage for the 30 seconds, on an otherwise idle Athlon XP 1800+.
> OpenLDAP (2.0) is running on that same machine, however using
> ldapsearch or exim yields immediate results.
>
> $ cat maillist.py
> #!/usr/bin/python2.1
>
> import sys
> import ldap
>
> INIT = "ldap://localhost/"
> BASE = "ou=People,o=International Teams"
> TIMEOUT = 40
>
> listname = sys.argv[1]
> ldapconn = ldap.initialize( INIT )
> results = ldapconn.search_st( BASE , ldap.SCOPE_ONELEVEL ,
>                 '(mailGroupLocalPart=%s)' % listname ,
>                 attrlist = ("uid",) , timeout = TIMEOUT
>                 )
> names = [ attrs['uid'][0]  for dn , attrs in results]
> print ' , '.join( names )
>
>
> $ time ./maillist.py AITP
> dann , derrick
>
> real    0m36.555s
> user    0m32.990s
> sys     0m3.490s
>
> $ time ldapsearch -x -h localhost -b "ou=People,o=International Teams"
> -s one "(mailGroupLocalPart=aitp)" "uid" | grep uid:
> uid: dann
> uid: derrick
>
> real    0m0.033s
> user    0m0.000s
> sys     0m0.010s
>
>
>
> I think this rather clearly points to python-ldap as the culprit.  I
> need to do some integration of LDAP and some web-based programs, and
> would like to work with python, but this sort of performance hit just
> won't be usable.  I'm willing to help with the code, if you point me
> to the interesting parts (and help me learn the C API of python and
> openldap as I go).
>
> I did a quick glance over the archives and read this thread :
>     http://www.geocrawler.com/lists/3/SourceForge/1568/0/8932688/
>
> -D
>






More information about the python-ldap mailing list