Space Admin is slow to load on large spaces
Problem
- Space Admin takes several seconds (or longer) to load.
- The space in question has several thousand pages.
- Smaller spaces do not appear to have the same long load time.
Cause
Viewing the Space Admin page invokes the editspace.action. One of the classes called in this process makes a call to get all pages in a space. This is done to populate the drop-down for setting the space home page. The code looks something like this (taken from version 3.4.3):
public class EditSpaceEntryAction extends AbstractEditSpaceAction
{
public List getAvailablePages()
{
if ((availablePages == null) && (getSpace() != null))
{
availablePages = new ArrayList(pageManager.getPages(getSpace(), true));
Page blankPageAtTop = new Page();
blankPageAtTop.setTitle("");
availablePages.add(0, blankPageAtTop); // Give user the option not to select any home page
}
Collections.sort(availablePages);
return availablePages;
}
public void setSpaceManager()
{
}
}
Workaround
We have provided a patched version of the class responsible for the getPages() call. This patch was created for Confluence 3.4.x and might be compatible with other versions. Please test it on a development instance before implementing it on your production instance. Also, as a precaution, make a backup of your instance before proceeding.
To implement the patch:
- Download the attached EditSpaceEntryAction.class.
Create the following directory path (you may need to create one or more of the directories):
<confluence-install>/confluence/WEB-INF/classes/com/atlassian/confluence/spaces/actions/
- Copy the EditSpaceEntryAction.class into the new actions/ directory.
- Restart Confluence.
Resolution
There is currently no elegant solution to this problem. A bug report has been raised to address the issue of scaling. You are encouraged to watch and vote for this bug.