In this tutorial, you will learn some handy performance tuning tips that will help make your Episerver website blazingly fast 💨💨💨
With the advent of faster servers and quicker internet connections, it's quite surprising that a study done by Radware found that in eCommerce sites at least, web performance has slowed on average 16% this year compared to previous years. If you want to make sure that your websites become faster and not slower, read on 🔥🔥🔥
Measuring Performance With A Stress Testing Tool
A commonly overlooked step that a number of my clients fail to plan/consider is the stress test. It's very easy to build a fast website that works on your local development machine, however, when you start to get traffic, how is your site going to respond? Getting performance at scale correct is hard. I'm sad to say I've personally experienced website stability issues on some of my projects.
This is why perf testing is important. How will the site behave on its busiest day? There are loads of reasons why your site might spike in traffic. Your client has made national news, or its Black Friday. For a short period of time, you get 1000x times more traffic than usual. These busy days are when your client can make the most amount of money. If the website falls over, that's a lot of lost opportunity!
One way to ensure that the site performs in these scenarios is to do some load testing. Nowadays, there are a number of tools available on the market to load test your website.
Personally, I've used Load Impact before. Load Impact gently ramps up your traffic over a specified period so you can measure the traffic capacity your website can handle. Load Impact uses a freemium payment solution where you can create low load simulations by recording interactions with your Episerver site and then replaying those actions up to 100 virtual simultaneous users for 5 minutes for free. After that, you have to pay. Other load testing tools I've heard good things about include BlazeMeter, Browsermob and LoadStorm
Have Good Page Speed
One way to make sure your website loads quickly is to use a tool like YSlow. I have written a specific guide on how to use YSlow with Episerver here. I recommend you read that and follow the steps
Use A CDN
You should always use a Content Delivery Network (CDN) like CloudFlare or Amazon CloudFront on your site. A CDN is a service that enables the static content on your site, like images and HTML files, to be distributed across a network of servers around the world. The idea being that the closer the assets live to the site visitor, the quicker your website will load. By using a CDN and moving your static content onto servers that are physically closer to visitors, network latency will be reduced. Also, by moving the requests for static files off of your web server and onto a CDN, you also reduce the total load on your web server, meaning you can deal with more simultaneous users.
Usually to set-up a CDN you route your sites DNS via the CDN's network. If you do this be aware of any other services the client might use. If the company has all their SMTP traffic going through that IP, re-pointing it to a CDN might cause things like the company's emails to stop working. Don't switch over a clients DNS without doing some proper research and talking to the network guys.
Separate Database Server
Another good practice, is to consider moving your database onto a separate server to improve the performance of your Episerver website. Moving your SQL database onto a seperate server will free up capacity on the web server and should increase total visitor capacity. The thing to consider in this set-up is cosr. There is a cost for running two servers. If you have a simple low-traffic brochure-ware site, this might be overkill.
Load Balancing
After using a CDN and a separate server for your database, if you are still having performance issues then it's time to start thinking about load balancing. If budget isn't an issue, then I will always recommend a load balanced setup as it makes deploying new releases much easier. Load balancers allow you to start using a Green/Blue deployment strategy. In this strategy, you take one node down, upload the code, bring it back up and take the other one down. Using this type of approach means that you shouldn't have any downtime on your releases.
Adding load balanced solution does introduce a little bit of extra set-up complexity. When you use a load balanced environment, you need to start thinking about things like shared caches, content publishes, shared assets, etc... There are load of resource online to help you in this area.
In today's tutorial, we've covered some of the most commonly used tricks that are used to boost capacity and sky rocket performance within an Episerver CMS powered website. Have your own view? Leave a comment below. Happy Coding 🤘