[prev in list] [next in list] [prev in thread] [next in thread] 

List:       python-ldap-dev
Subject:    slow bind
From:       jacob martinson <martinson.jacob () gmail ! com>
Date:       2005-07-27 22:12:13
Message-ID: 5b7479590507271512231c189a () mail ! gmail ! com
[Download RAW message or body]

I have a small script using python-ldap in python-2.3 and it takes
about 3.5 seconds to perform a simple bind to our server.  I can
perform a complete search from the command line with ldapsearch in
about 0.02 sec.

I've appended the code & timing output.  Am I missing something here?

Thanks!

-Jacob


$ time ldapsearch -x -h host -D "cn=Jones\, Bob,cn=Users,dc=dom,dc=com" \
> -w pass -b "cn=users,dc=dom,dc=com" "sAMAccountName=acct" mail
# extended LDIF
#
# LDAPv3
<snip>
# search result
search: 2
result: 0 Success
# numResponses: 2
# numEntries: 1

real    0m0.024s
user    0m0.003s
sys     0m0.006s

$ cat ldaptest.py
#!/usr/bin/python

import ldap
import profile
import time

from pprint import pprint

def ldapsearch():
        passwd='adsf'

        t0 = time.time()
        l = ldap.initialize("ldap://server:389")
        t1 = time.time()
        print 'ldap.initialize() ' + str(t1 - t0)

        t0 = time.time()
        l.bind(who="cn=Jones\,
Bob,cn=Users,dc=dom,dc=com",cred=passwd,method=ldap.AUTH_SIMPLE)
        t1 = time.time()
        print 'l.bind()          ' + str(t1 - t0)

        t0 = time.time()
        msgid =
l.search(base="cn=users,dc=dom,dc=com",scope=ldap.SCOPE_SUBTREE,filterstr="sAMAccountName=acct",attrlist=['mail'])
  t1 = time.time()
        print 'l.search()        ' + str(t1 - t0)

        t0 = time.time()
        res = l.result(msgid)
        t1 = time.time()
        print 'l.result()        ' + str(t1 - t0)


if __name__ == '__main__':
        ldapsearch()

which produces:

$ time ./ldaptest.py
ldap.initialize() 0.00811719894409
l.bind()          3.45404982567
l.search()        0.00253987312317
l.result()        0.00940012931824

real    0m3.557s
user    0m0.030s
sys     0m0.070s


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id492&opĚk
_______________________________________________
Python-LDAP-dev mailing list
Python-LDAP-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/python-ldap-dev


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic