Automatically scale Sitecore on Azure PaaS

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.

scaleup

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:

  1. 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.
    scalemanually
    In the above image, I’m simply making sure that we’re going to run on 3 instances.
  2. Scale on CPU percentage. This option is a bit smarter, we can now automatically scale up.
    scalecpu.png
    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.
  3. 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.
    scaleout
    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.
    recurrence
    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.
    schedulerules

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.

Advertisements

2 thoughts on “Automatically scale Sitecore on Azure PaaS

  1. Pingback: The brave new world of Azure PaaS | Jeremy Davis

  2. Pingback: Sitecore on Azure… With Unicorn | Sitecore and such

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s