Sitefinity Performance Boost: Precompile Frontend and Backend Pages

by Gregg Crystal Nov 25, 2016

Speeding up Sitefinity is a topic that comes up over and over again. This is perhaps one of the easier tips you can do to increase the performance of Sitefinity.

All of the pages within Sitefinity are built on the fly from the database, but they can be 'precompiled' and saved to a dll.

Precompiling can speed up your site, especially if you have lots of pages and don't make lots of changes to your site.

Don't worry if you do make changes though. Sitefinity is smart enough to know that you've changed a page from what has been precompiled, and will dynamically load a changed page instead of pulling it from the precompiled dll.

This is an option you'll need a developer for, and something you should try out first on a test site, not your production site.

More info can be found here.

Here's a quick run down of the tool:

1. Unzip the compiler tool and place it in your site's bin folder.

2. Run this command line, once for the Frontend and once for the Backend.

3. Below, I've already moved the Telerik.Sitefinity.Compiler.exe program to the bin folder. Hold shift and right click in Windows Explored to get the 'Open command window here' option.

Sitefinity Speed Boost: Precompile Frontend and Backend Pages

Telerik.Sitefinity.Compiler.exe /url="http://localhost:82" /appdir="c:\websites\825900" /username="admin" /password="adminpassword" /strategy="Frontend" /membershipprovider="Default"
Telerik.Sitefinity.Compiler.exe /url="http://localhost:82" /appdir="c:\websites\825900" /username="admin" /password="adminpassword" /strategy="Backend" /membershipprovider="Default"

Note that appdir is the top level directory of your site, NOT the bin folder!

Also note that the program is going to login with the username specified. If you access the Sitefinity backend while this program is running, you'll be prompted with the 'someone is already using this username' message. Do not Log the other user off, since it's the precompiler tool doing its thing.

Sitefinity Speed Boost: Precompile Frontend and Backend Pages

Once completed, you'll see these two Telerik.Sitefinity.PrecompiledPages DLLs in your bin folder.

Sitefinity Speed Boost: Precompile Frontend and Backend Pages

Your results will vary with this. Personally, I don't have any solid metrics but I do feel that the backend runs faster. It feels snappier.

The front end is completely dependent on the number of pages your site has. In a big site, with 100+ pages, I would imagine that the results would be noticeable.

Bonus Material

What could go wrong?

Well, if you put a backslash on the end of your appdir, this is the error I got:

Sitefinity Speed Boost: Precompile Frontend and Backend Pages

That's right. It says that 'A value for the Strategy property is required.' This one was frustrating because you can see I have the 'strategy' property defined. It also crashes the Precompiler program!

Took a while to figure this one out, but I had to change the appdir parameter from "c:\websites\825900\" to "c:\websites\825900".

After changing that it works just fine:

Sitefinity Speed Boost: Precompile Frontend and Backend Pages


Ready to Supercharge Your Sitefinity Project