Monday, October 29, 2007

Don't Sort on the Server in Active Directory

This is just a reminder that you should not use server-side sorting with your queries in Active Directory or ADAM.  This situation was reinforced when a reader asked me why a particular ASQ (attribute scope query) was failing with an error when querying a rather large group (more than 20,000 members).  The customer was getting a fairly nondescript error, "The server does not support the requested critical extension" about halfway through his results.

After checking the network trace, and handing the DSID error back to my buddy Eric - we (more he, than me) determined it was failing in the code path for sorting.  It turns out that sorting this much data on the server requires temp table space.  If you run out of space before the sorting is complete you get this type of error.  This is not particular to ASQ by any means, but all sorting.

The moral of story is don't sort on the server.  This is a very real example of why this is the case.  You can always easily sort once you have results on the client.