A search that multiplexes servers can make a request to an array of hosts. A search that multiplexes query statements can make different requests to different subtrees of a server. If you combine these search methods you can perform complex searches across a number of servers without having to wait for individual responses. The following example illustrates a practical use of multiplexed searches and the asynchronous interface. Suppose we want to implement event notification as a generic service using LDAP persistent search.
Synchronous methods require a new thread for every request to the service.
This solution is not scalable and can exhaust system resources very quickly. If we rewrite the search using the asynchronous interface, performance will improve dramatically. Since asynchronous searches do not block until completion, we can multiplex the persistent search results into one queue and then process them on a single thread. This object acts as a message queue and accepts search results and server-generated responses to LDAP requests. It is the responsibility of the LDAP client to read and process these messages.