Hi all, I am learning to use OpenLDAP API with no particular problem. Anyway I have a question: why should I use asynchronous functions? From the LDAP client point of view, do they use less memory or more? I have this concern because my code will have to work on an embedded system with not much RAM.
Ciao JM
johnmiller@email.it writes:
why should I use asynchronous functions?
Your application might have some other work to do. Like responding to user input, if it's an interactive application. Then you can send the LDAP request, do some work, check for the LDAP response, if it has not arrived do some more work, and so on.
Also you don't need to wait for the response to one LDAP request before sending the next, except with Bind and Start TLS.
From the LDAP client point of view, do they use less memory or more?
The ldap_<foo>_s() functions are just wrappers around ldap_<foo>() followed by ldap_result() and maybe ldap_result2error(). So you might get them to use less memory on errors if you cripple your error handling, but otherwise it should make little difference.
I have this concern because my code will have to work on an embedded system with not much RAM.
Then I'd also look for a smaller LDAP library than that from OpenLDAP, one which supports fewer LDAP features. If you don't need many, anyway. Try ldap@umich.edu, or the #ldap channel at IRC net Freenode.
Hallvard B Furuseth wrote:
johnmiller@email.it writes:
why should I use asynchronous functions?
Your application might have some other work to do. Like responding to user input, if it's an interactive application. Then you can send the LDAP request, do some work, check for the LDAP response, if it has not arrived do some more work, and so on.
Also you don't need to wait for the response to one LDAP request before sending the next, except with Bind and Start TLS.
Another advantage is that if entries returned by a search can be independently handled by the client, you don't have to wait for the whole dataset to be available to start handling it.
From the LDAP client point of view, do they use less memory or more?
The ldap_<foo>_s() functions are just wrappers around ldap_<foo>() followed by ldap_result() and maybe ldap_result2error(). So you might get them to use less memory on errors if you cripple your error handling, but otherwise it should make little difference.
Well, in case of a search that returns a lot of objects, using an asynchronous call will give you a chance to deal with entries as soon as they come in, so you might end up using less memory.
p.
openldap-software@openldap.org