Platform SDK: Active Directory, ADSI, and Directory Services |
Paging is set by defining how many rows the server calculates before the data is returned to the client over the network
By default, the server responding to a query request will completely calculate a result set before returning the data. In the case of a large result set, this ties up server memory as the result set is being acquired, and network bandwidth when the large result is returned. Setting a page size allows the server to send the data in pages as the pages are being built.. The client will then cache this data and provide a cursor to the application level code. Be aware that even though a page size may be in effect, if a sort order is defined, the server must completely calculate the result set before returning the data to the client.
Paged searching offers benefits to both the client and the server. For instance, the client can be more responsive in presenting the results to end users. This is especially relevant to graphical user interface tools that can begin displaying data while another thread concurrently receives more from the server.
On the server side, paged searching makes the operation scalable. Suppose that one hundred clients issue search requests simultaneously and, on the average, each client gets back two hundred objects. If no page size is specified, the server must have sufficient memory to hold 20,000 objects. On the other hand, if each client were to specify a page size of ten objects, the memory requirements on the server would be reduced by a factor of 20.
Note Not all directory servers support paged searches. Active Directory is one that takes advantage of page size architecture.
Many directory servers specify an Administrative Limit for the maximum number of objects they can return if a client does not specify the page size. When the Administrative Limit is reached, ADSI generates the ERROR_DS_ADMIN_LIMIT_EXCEEDED Win32 error.
In a paged search, a client can abandon the operation in progress. In contrast, in a non-paged search, the client is blocked until the data is completely returned, or an error occurs. This could potentially put a heavy burden on the network.
On behalf of the client, ADSI handles the page size transparently. The client does not have to count the number of objects in progress. ADSI encapsulates the server interaction for the client. From the client's perspective, the search comes back with a complete result set.