Performance issues when using “Save Site As Template” option with content in SharePoint 2010

Scenario Description

We recently hit a performance problem on a client environment when creating sites through code. These sites which had been created with the Team Site template and then saved as templates by using the “Save Site As Template” option in the UI were taking upwards of 40 seconds to deploy.

During testing we then found that all sites were taking significantly longer periods to deploy, including those built with out of the box Team Site and Blank Site templates.

Re-creating the issue.

In order to prove the issue, I built a new SharePoint 2010 server and deployed a new web application with no customisations and only minimal configuration. No user profile, no search etc.

A new web application was created with a site collection and then a root site based on the Team Site Template.

A new sub-site was created from the root, and a fiddler capture showing the time taken from submitting the AddGallery.aspx page to the redirection to the created subweb. This timed the sub-site creation at 1.997 seconds.

clip_image001

A small amount of content was then added to this team site (~5Mb of mixed word documents and images) and then the site was saved as a template including content.

A new Team site (Based on the OOTB Team Site, not the Template) was then created, again using fiddler to measure the time taken from submission of AddGallery.aspx to the redirection to the new sub-site.

clip_image002

In this instance the site creation time was measured at 3.863 seconds.

The template created in the previous step was deactivated in the site collection user solution gallery. Further content was then added to the site used as the template base and a new template created with content. This time containing ~30Mb of content of mixed types.

A new team site was created once more with a fiddler trace.

clip_image004

Image edited to fit on page. This creation was timed at 21.416 seconds.

The user solution containing the large content was then deactivated in the user solution store and another Team site created.

clip_image005

Site creation was timed at 2.172 seconds.

Issue Summary

Whenever the ‘Save Site as Template’ option is used to create a template that contains content, there is a performance hit in the site collection when creating new sites from ANY template including out of the box ones.

The issue is limited to the site collection as it is related to solutions stored in the User Solution Gallery which has a site collection scope.

This issue has been recreated on several environments at various patch levels from RTM to December 2012 CU.

Potential Workaround

A further test revealed that downloading the User Solution, importing into Visual Studio 2010 and then changing from a Sandbox solution to a Farm solution before re-uploading into the farm removed the performance hit.

The key issue with this workaround is that it requires a developer and farm deployment, thus negating the benefits of user solutions and it does not fix the problem for the future. It is always possible that any user with the relevant rights could create a site template with content and potentially cause major problems with site management.

Leave a Reply

Your email address will not be published.

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.