Although performance made large strides between Sakai 2.4.x and 2.5.x, we still find that large course sites can exhibit unsatisfactory initial response times. For example, an instructor in charge of a site with 700 students will have to wait about 25 seconds for the "Site Info" page to load the first time.
By far the single biggest chunk of time is spent on 700 calls to the UserDirectoryService "getUserByEid" method, one for each enrollment record, which translates to 2100 DB queries:
1. Get set of Enrollment records from Course Management. (One query which returns ~700 EID fields.)
2. For each Enrollment record, get the student's user record (basically the UUID, name, and email) by calling UserDirectoryService "getUserByEid(studentEid)".
3. Each one of those calls does a query to find the UUID corresponding to the EID, another query to try to find the user data in Sakai's local user table (this will fail except for guest accounts), and then finally calls our UserDirectoryProvider which uses the EID to do another query against our externally-provided user tables.
All the tables are indexed and cached well enough, and so the only way to reduce the time is to stop making so many queries.