Scaling Up and Scaling Out in Azure
For a long time, hosting an application was constricted to server racks inside the same building as the company developing the web application. Scaling an application that is hosted in an internal environment has several challenges, ranging from equipment costs to physical space in a server room to the hours needed to replicate everything needed for the application.
Thankfully, Azure’s cloud infrastructure has made scaling up and scaling out an application very simple.
In this article, we’ll cover when and why you should scale your application with Azure, and then we’ll walk you through exactly how to do it.
Why Scale Your Application?
When you begin building an application, you may have grand plans for it to be adopted by thousands, if not millions, of users. Realistically, applications typically start off with a modest user base and grow over time, with rates of growth varying significantly by business.
As your application continues to grow, keeping your original architecture in place could start to produce a poor user experience. At this time, it’s probably time to consider scaling the architecture hosting your application. Below are a few reasons why scaling is a valuable tool when hosting your application in a cloud-based environment.
1. Improve Performance
Over time, your application may experience performance issues. This can be caused by high traffic volume, memory consumption, or complex logic taxing the CPU. When this happens, the first reaction is often to throw more resources at the problem. Azure offers the ability to scale up and scale out on a wide variety of assets in their suite of products. This provides a quick, simple way to add more performance to your application or split that high traffic volume with ease.
2. Prevent Application Outages
Once you have your first production outage you start thinking of user experience and uptime. This is a very good reason to have an application that can quickly and easily scale. You want to make sure that your user base can access your application at any time. Having multiple instances up and running allows for an issue to occur and your application still remains accessible.
3. Optimize Global Access
Another good reason to scale your application would be your user base. If you have users all around the world then you do not want to be stuck to a single region in Azure. By limiting your application to a single region, you are limiting yourself from providing the best user experience possible for a subset of your user base.
When your application needs access on a global scale, it is essential to ensure your application is located across several different regions in Azure. For example, MercuryWorks works with a client that has a global user base of physicians in need of ocular tissue for their patients. Global access was an important factor when we established their infrastructure.
When Should You Scale Your Application?
Now that the ‘Why’ is out of the way, the next question should be ‘When’. Depending on your philosophy for deployment, this question will come up in the beginning of your development lifecycle or potentially the first time you hit a major issue that needs immediate attention.
At Mercury, we partner with clients to help them anticipate what their needs will be at the onset of development and over time. We do this by modeling the client’s potential needs (if building from scratch) or reviewing the current performance metrics (if working on an existing application). From there we make recommendations for the optimal MVP-based architecture, knowing that scaling is always an option as the application gains adoption.
When it comes to different application scaling techniques, scaling up or scaling out typically depends on the volume of traffic on your application:
- Scaling out is the right solution for you if you are seeing very high traffic that is causing your application resources to spike. Scaling out will take your application and clone it as many times as necessary, all while adding a load balancer to make sure traffic is spread out evenly.
- Scaling up is the best approach if you have low traffic activity but are still seeing resources peak to 100%. Scaling up allows you to quickly add more resources to your application to allow it to process normally under highly stressful executions.
Both options are powerful tools in your arsenal, and neither take very long to accomplish. The act of configuring Azure for either is a few clicks and the processing time for Azure is a few minutes max.
How Can You Scale a Web Application?
A great solution for hosting web applications is Azure’s Platform as a Service (PaaS) architecture. It provides a lower maintenance cost because you do not need a Network Admin running updates each week to make sure you are up to date. It also provides a very quick scaling option should you decide your application is not performing up to your expectations.
In this section, we are going to walk through how easy it is to scale your application. Azure has several assets that can help you quickly and easily scale your application with a few clicks of a mouse. Here we use Azure App Service and Azure SQL Database. They both have the concept of “Scale Up,” but App Service has the added feature called “Scale Out.”
Scaling Up
Scaling Up is the classic answer to a technology problem, which is to throw more resources at the situation until it resolves itself. All Azure assets have different pricing tiers that can provide various levels of resources depending on your needs. Below is a screenshot of what you will see when you are working to scale an Azure SQL Database:
As you can see, there are several options to choose from when making your decision. Azure SQL Databases have 3 tiers of performance: Basic, Standard, and Premium. Each tier allows the database to have a maximum number of resources available. To scale this type of resource, you simply pick the category that fits your needs, adjust the sliding scale to add/remove resources, and click Apply.
When it comes to Azure App Service, the scaling process is more direct. When you select the “Scale Up” option located in the navigation you will be taken to a slightly different screen layout. You still have 3 tiers to choose from, but this time you have set options to pick instead of sliders. As you can see in the screen shot below, this blade also shows you the currently selected resource package. To change your currently selected package, all you need to do is select a new version and click Apply.
Scaling Out
Scaling out is a special option available to Azure App Service. This feature allows you to create one or multiple clones of your existing application to better balance traffic or resource load. Essentially, it’s like creating multiple App Services that all live behind a Load Balancer. The Scale Out feature is available in two methods, Manual Scale and Custom Autoscale. Both can help you accomplish your goal of allowing your application to be more performant for your users.
Manual Scale is just as it sounds: you’ll be given a simple slider that will tell Azure how many active instances of your application you want available. But Custom Autoscale is where the magic really happens. Here you can define a wide range of requirements for your application to be scaled out for you. Azure has over 20 different options you can choose that will let you define upper limits for when your application should scale on its own!
Making Scaling Easier
With the push to cloud-based hosting, having a quick and easy method to scale your applications is very critical. Azure provides the tools necessary to achieve this expectation with some of its most popular PaaS offerings. The best course of action is to start early and have a plan in place. Azure provides excellent automation tools and alerting that will allow to gauge when the time is right to scale your application and bring it to the next level.