Sitecore Configuration Customized Per Site in Multi-Tenant Installations

August 27, 2014

A common Sitecore installation has multiple websites running off of the same directory on a web server.  This is called multi-tenancy and can save on maintenance, licensing costs, and server costs (if setup correctly).  However, it also can lead to less granular control of configuration and global resources since they are shared.

One way around the shared configuration is to use Virtual Folders in IIS for the /App_Config/Include directory.  Sitecore dynamically updates the site configuration based on patch files here and IIS allows you to overwrite an existing directory with a virtual one.  This flexible configuration helps you solve issues like only clearing the affected website’s cache during a publish.

In contrast, the less IIS Sites on your server the smaller the memory footprint.  I ran a number of tests to determine what configuration settings had the greatest impact on performance.  I was surprised to find that combing websites into fewer IIS Sites had the most drastic impact.  Read more about the tests here:

http://andyfitz.me/blog/index.php/2014/08/27/sitecore-performance-testing-on-multi-tenant-configurations/

How to Setup

If you've never dealt with Sitecore configuration patching, read one of the following posts:

You can also just look in the following directory to see the Sitecore provided configuration patch files:
/App_Config/Include

There is a specific syntax for patch files that will allow you add/edit/delete any configuration settings in the configuration/sitecore section.  If you make several different patch files, you can have different configurations based on which one you use.

To assign the correct patch file, you will need to create a separate Include directory for each IIS site.  I have a Configuration directory outside of the website root that contains each site's configuration files.  Then in IIS, you create a new virtual directory over the App_Config/Include directory pointing to the customized site's Include directory.