How to Optimize Orchard CMS for Microsoft Azure

At Atilus we realize that great web design and development is a balance of many disciplines and the web is a unique place where – what I do as a developer, or how I setup a server – can affect the businesses we work with. And with Google and other search engines playing such a critical role in the marketing we do for our clients, it’s important that each of the sites we develop perform well (fast, no problems, etc.). Great performance isn’t JUST important for users, but also to ensure our sites stay ahead of and outrank their competitors. Speed, uptime, and time-on-site (which are all heavily influenced by what I do in the back on our CMS and our servers) are all things search engines are paying attention to and things that are vital in the success of any project. Not to mention – the more performance we can squeeze out of our servers the less expensive each server costs.

Orchard Performance Problems

I’ve put together a list of some of the most important and easy-to-implement optimizations we’ve discovered while using Orchard CMS these last couple of years. Read my post on Orchard for a quick review on the platform and why it’s one of our go-to-CMS’.

Have you experienced a scenario like this –
Orchard CMS

Everything is all greased up and ready to go, but what’s this? Orchard CMS is using almost 1GB of RAM? So you begin to think, maybe Orchard is extremely fast because of all the caching? How is it that Orchard runs much better locally than on an Azure Web Server?! Caching, via Azure, does help the performance but this site is new and not loaded with tons of data quite yet. Orchard’s footprint on the Azure web server should be much smaller.

This happened to us when we first started working with Azure.

At Atilus we host more than a 100 of our custom Orchard CMS websites on a single Azure webserver. What I am going to discuss in this article will help make Orchard use less resources which will directly affect the server website density. More sites on one Azure web server, that run faster and use less server resources equals more money for you. I’m going to go out on a limb that we can all agree this is a good thing.

Let’s Define a Few Things

  • Orchard CMS – Content Management system built on MVC.NET framework
  • Cache – Storing data in memory for later quick retrieval
  • RAM – Random Access Memory which the server uses to cache the DLLs, run the website, store cached data from the site.
  • DLL – Dynamic Link Library which is the code compiled into a single file the website uses to execute code needed run the site

Orchard & Azure Performance Optimizations

When you download the source code for Orchard you are downloading all of the source code and modules for Orchard. By default Orchard sets the modules to dynamically compile. This means that you are uploading the source code to the server and it’s compiling the code at run time instead of using precompiled libraries.

This is the single biggest optimization I’ve found when setting up Orchard to run as fast as possible on Azure – DON’T ALLOW ORCHARD TO COMPILE THE CODE AT RUNTIME.

For the most part the libraries are already compiled but if you download any from the gallery you will soon see that many are not precompiled.

To solve this issue, we develop locally and download all of the modules and precompile them before loading them to the server. If you are using Visual Studio then this process is made very simple by just building the application and then publishing it to the Azure server.

Publishing a Orchard CMS to Azure via Visual Studio

From the dashboard of your Azure website choose “Download the publish profile”. Then from Visual Studio you select the Orchard.Web and choose publish. You can then import the publish profile downloaded from Azure. Simple as that.
Azure Download Publish Profile

Orchard CMS Poor Performance – Debugging and Monitoring

In addition to the major optimization of simply pre-compiling everything before publishing to Azure, I’ve found a few additional tweaks that prevent problems and increase speed.

First, you always want to build the application in “Release” mode as opposed to “Debug” mode.

Visual Studio Release Mode

Next, Orchard CMS has a few settings that are located in the Orchard.Web/Config/HostComponents.config file which will help remove a sporadic issue we have found that causes heavy RAM use. The optimization is simply setting “Disabled” to “True” for the following setting “Orchard.Environment.Extensions.ExtensionMonitoringCoordinator.” If your Orchard install was randomly taking up too much RAM on your system, doing this should solve the problem.

Disable Extension Monitoring

Optimizing Website Load Times Azure and Visual Studio

As I mentioned above, speed and reliability are crucial. Now-a-days if a site or application isn’t loading extremely fast, you’re going to be losing users. This is to bbe expected and has (pretty much) always been the case. However, what IS NEW is the idea that Google and other search engines, via big data and their analytics tools, are tracking users’ time on your website…

And if users are leaving – Google and others will demote your website. If users stay (say because you provide a great fast experience) Google will boost your website.

So speed is critical. One component of speed is the server, one component optimizations on the CMS/Application level, but a 3rd area is the front-end. Here, we use Visual Studio and Web Essentials.

Making sure to compress your images as well as minify all the stylesheets and javascript files can boost your website performance because it shrinks the file size by removing the whitespace. I accomplish this via Visual Studio with the Web Essentials add on which automatically minifies your files for you.

Web Essentials Minify Css

The Round Up

There are always steps to take during the development process, including small tweaks here and there that lead to the software performing at it’s best. With everything configured and compress you’re left with a well performing CMS that doesn’t overuse and abuse resources. Remember the configuration steps, compress and compress it some more and you can’t go wrong.

Harry Casimir
Harry Casimir
Harry Casimir is Atilus’ co-founder and Director of Technology. He oversees the strategic technical direction of the company among many other things he has his hand in at the company.

Leave a Comment

 

Recent Comments | 0 Comments
Recent Posts

Contact Us

We're not around right now. But you can send us an email and we'll get back to you, asap.