Architecting your Orchard CMS Site for Cost Savings & Performance
Back in March of 2015 I wrote a post titled How to Use Azure BLOB Storage and Azure CDN for Scaling Web Applications. This post was meant to help users speed up their webistes by utilizing Azure offerings like BLOB storage and Azure CDN. These features are nice because they allow you to offload requests from your website and serve cached content to users from nodes nearest to them. The other benefit that I will write about today is how to architect your Orchard CMS site so that you can provide cost savings in Azure.
Typical Azure Orchard SetupA typical Orchard CMS setup in Azure will typically consist of a Windows Azure Website and a SQL Azure Database. This is by far the easiest way to stand-up a basic site. Unless of course you decide to go with SQL Compact. Then no need for SQL Azure. When you setup a site with SQL Azure and a Windows Azure website you are going to need a Standard tier 3 database and a Standard Web App tier 3 as well. Orchard requires a fair amount of database calls out of the box and also will require a 7GB RAM web server to run. This is because the next web app tier down is 3.5GB. This is not enough for a fairly traffic heavy site. It frustrates me that Azure has not shifted some of these thresholds. 3.5GB is really not a medium sized server at all in my opinion. You may be asking why there is a need to be on the Standard tier over Basic. The reason is that Azure's backup feature is not present in the Basic tier. This is a necessity in content management type sites because of the Media directory requiring backuip. If your site was ever to be lost or corrupted, you would need to restore it from a backup and having your Media directory stored in the website requires you to be backing it up. Secondly, if your credit card expires or you go into delinquency on payments with Microsoft the first thing they do is tear down your deployments and only preserve your data. This means your webroot would be blown away only leaving any BLOB storage or SQL databases. This would be awful if you lost your entire media director. Here is what your looking at for a monthly price point :
SQL Pricing :
App Pricing :
The total is $447.59 a month. This is a tough sell for some smaller business that require a content management system and a site that can respond to an average amount of requests. In the next section we will detail how to tweak Orchard's setup and Azure to provide a performant site with some cost savings and even some failsafes for site backups.
Architecting for SavingsThe first step in providing some cost savings is to figure out what the real differences are in Standard vs. Basic app tiers in Azure. If you review the pricing guide you will see that there really is not much a difference other than you don't get automated backups and there is signifigantly less storage space. Other than that they are very similar in my opinion. Simply downgrading our tier to Basic level 3 we save almost $75.00 a month!
You may be asking, well what do we do about the Media directory not backing up now and also the less storage to support it? Well that's simple, Orchard CMS can run on BLOB storage as a Media backbone. This is excellent because then all of our CMS media is stored in BLOB storage which means it can be geo-redundant and easily snapshotted in Azure. You could even sync the Media directory to another storage container should you ever lose it and need to restore. Lastly, it is great because we can now switch on Azure CDN and serve CMS content right from Azure CDN. This improves speed of our site by offloading image requests to BLOB storage and the CDN as well as serving images off cached servers near our clients. Read this Github thread about how to configure the CDN. In order to use Orchard CMS BLOB storage you just enable it in the Modules area.
The SysCache module is great because it enables caching at the database level. This greatly reduces the trips to the database. Secondly, the Output Cache will use server memory to cache whole pages in server memory. These modules together are excellent ways to make sure your site performs well. You could even use an external cache via Azure Output Cache or Redis if you wanted. This reduces server load and database load which lets us drop our tiers from 3 to 2 for more cost savings!
By turning on these modules we have now saved $256.64 a month! Even if wer had to move the app tier back up to Basic 3, it still would be $145.04! We can even leverage a scaling technique as well in order to handle high traffic times to save money as well. Autoscale is not included in Basic tier, but you could script something for yourself. Having your Media in BLOB storage makes scaling and potentially having to redeploy to another data center much easier as well.
I hope you take these few simple things into account when architecting your Orchard CMS website so you can acheive optimal performance while saving your client some money as well! These are real savings that your client will appreciate!