Since Sitecore 8.2 update 1, we can simply scale our App Service plans up or out. You can find these options on the App Service Plan as well as the App Service themselves.
Scaling up means selecting a different tier for our subscriptions – more RAM and cores for instance.
As you can see, I’m currently running on the S1 tier – which I can’t recommend to anyone as it’s quite slow (of course, it is way below the minimum specs found in the installation guides)…
Our other option is to scale out. That means we can add (or remove) a number of instances based on… something. Let’s take a look.
When scaling out, we have a couple of options:
- Scale manually. I can do this by setting the ‘scale by’ field to the option ‘an instance count that I enter manually’. I can select a number of instances using a slider.
In the above image, I’m simply making sure that we’re going to run on 3 instances.
- Scale on CPU percentage. This option is a bit smarter, we can now automatically scale up.
As the above image shows, I’ve set Azure up to use 2 instances at minimum and 7 maximum. Azure will automatically scale this based on the target range of the CPU – if that falls between 80 and 100, a new instance will be added (up to the maximum of 7 instances). If it falls below that minimum in the target range, it will automatically scale down as well.
- Scale on schedule and performance rules. The performance rules are pretty similar to the previous option, but gives us a bit more flexibility and power.
As you can see in the above image, we’ve set a Default profile up, with a scale of 1 as minimum and 10 as maximum. We then have 2 rules: One to scale up, every time the CPU percentage hits 80% on average, over the past 10 minutes (see the right hand side), it will auto-scale up. In addition to that, it will also auto-scale down when on average over the past 10 minutes the CPU percentage is <1. Which might be a bit too low…
There are other metrics that we can use rather than CPU percentage there as well, and these rules can be set to scale up differently, for instance spinning up a different number based on the metric selected.
We can also scale on schedule. If I know that I have very high traffic during the week and lower during the weekend, or if my traffic is high during work hours but low outside of them, or even if I have a fixed date that I know I have high traffic I can make sure I scale based on that as well. For this we need to select the scaling profile.
For the first couple of options mentioned above I can use the ‘recurrence’ tab. For the fixed date, I can (obviously) use the ‘fixed date’ tab, where I can set a start date/time and end date/time. I’ll need to create a profile for my high traffic and low traffic as well, and build out the rules for both.
There is one really important point here that I have yet to mention: Licensing. If you are on a perpetual licensing model and you want this auto scaling functionality, I would highly recommend putting in the maximums to make sure you won’t be in breach of the license.