[python-ldap] ldap.OPT_DESC, async ops and paged search controls

Michael Ströder michael at stroeder.com
Tue Jan 27 22:26:18 CET 2015


Mark R Bannister wrote:
> As you can see, I may have many LDAP objects in different states,

There is no internal state of a LDAPObject instance. And I wonder why you open
a separate LDAP connection for each worker thread. I don't think you need that
since you can send several LDAP requests on one connection and dispatch the
incoming results my msg_id to the queued request (see result type of
LDAPObject.result2() and higher).

1. Just queue the incoming requests,
2. send the accompanying LDAP request on the single connection,
3. attach msg_id tp queued request and
4. have *one* result thread repeatedly calling LDAPObject.result2() and
5. finally dispatch the results by msg_id to the queued incoming request.

With this approach you wouldn't even need so many worker threads and you're
not overloading the server with so many connections.

It's not trivial of course because you also have to take care of the result
type to determine wheter all results for a single msg_id were received. But
that's what you have to take care of anyway when calling
LDAPObject.result(msgid=RES_ANY) like in your examples.

Also decent caching is mandatory.

YMMV though.

Ciao, Michael.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4252 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://mail.python.org/pipermail/python-ldap/attachments/20150127/854d231f/attachment.bin>


More information about the python-ldap mailing list