Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are SharePoint site templates really less efficient than site definitions?

So, it seems in the SharePoint blogosphere that everybody just copies and pastes the same bullet points from other blogs. One bullet point I've seen is that SharePoint site templates are less efficient than site definitions because site definitions are stored on the file system. Is that true?

It seems odd that site templates would be less efficient. It's my understanding that all site content lives in a database, whether you use a site template or a site definition. A site template is applied once to the database, and from then on the site should not care if the content was created using a site template or not.

So, what is an architectural reason why a site template would be less efficient than a site definition?


Edit: Links to the blogs that say there is a performance difference:

  • From MSDN: Because it is slow to store templates in and retrieve them from the database, site templates can result in slower performance.
  • From DevX: However, user templates in SharePoint can lead to performance problems and may not be the best approach if you're trying to create a set of reusable templates for an entire organization.
  • From IT Footprint: Because it is slow to store templates in and retrieve them from the database, site templates can result in slower performance. Templates in the database are compiled and executed every time a page is rendered.
  • From Branding SharePoint:Custom site definitions hold the following advantages over custom templates:
    • Data is stored directly on the Web servers, so performance is typically better.

At a minimum, I think the above articles are incomplete, and I think several are misleading based on what I know of SharePoint's architecture.

I read another blog post that argued against the performance differences, but I can't find the link.

like image 923
Jim Avatar asked Mar 04 '09 21:03

Jim


People also ask

How is the site template different from the site definition?

A site definition defines a unique SharePoint site. Site Templates are created from an existing site. Usually created after customization.

Can I use a SharePoint site as a template?

Save a site as a template to the solutions gallery Navigate to the top-level site of your site collection. Click Settings, and then click Site Settings. In the Site Actions section, click Save site as a template.

How do templates work in SharePoint?

SharePoint site templates are prebuilt definitions designed around a particular business need. You can use these templates as they are to create your own SharePoint site, and then customize the site as much as you want. For more information, see Using templates to create different kinds of SharePoint sites.

How can I tell what SharePoint template a site is using?

To check the site template of your site, do the following: Open your SharePoint Online site collection or subsite in the browser, Go to View >> Page Source. In the page source, search for “webTemplateConfiguration”, and you'll find the site template value next.


1 Answers

The performance impact of using Site Templates versus Site Definitions is generally overstated.

Why?

Well, lets take this example:

  1. You take a Team Site site definition.
  2. You save it as a new Site Template
  3. You then create a new sub web based on this new site template.

What have you got? Well, the important thing to remember is that "Ghosting" happens at the PAGE level, NOT at the SITE level. Since you have not customised ANY pages, then any pages you access are still coming directly from the Site Definition, directly from the filesystem.

Want to prove it, here are two tests:

First Test

  1. Try modifying the default.aspx page in the original Site Definition.
  2. Check your site template, notice you see the modification.
  3. Its still "Ghosted" to the filesystem

Second Test

  1. Create a new site definition.
  2. Create a new site based on this new Site Definition.
  3. Create a new Site Template
  4. Send the site template to a mate with SharePoint and ask them to create a new subweb based on it.

It will fail. Why? Because the Site Definition does not exist on their machine.

So, to get back to your question, "Are SharePoint site templates really less performant than site definitions?" my answer would be: "Performance considerations should not play a role in your decision to use a Site Definition or a Site Template, the functional objective you have should be". Now it get controversial, but for me, there are very very few reasons to opt for a Site Definition over creating Features.

As far as "Ghosting" goes. Yup, when customised your page will be stored in the Database, and yup, you will have to do a database round trip to get it. But, SharePoint, smart that it is, will of course cache this. So, in theory, yup its slower, in practice, no one really notices.

Ghosting has been in the product since 2003 (probably in STS before that, dont remember) and I have never seen official guidance on the performance impact it has, nor anyone speculating beyond the "it is slower" comments.

This leads me to believe that it just isn't really worrying about. The bigger worry with "Ghosted" pages is the difficulty that comes with maintaining them, but then, with 2007 and Masterpages this is a much smaller problem.

like image 155
Daniel McPherson Avatar answered Sep 23 '22 09:09

Daniel McPherson