For a long time, the concept of 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 man hours to replicate everything needed for the application. Azure has made this process very simple! To start we should go over a few reasons why it would be necessary to scale your cloud-hosted application.
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, the original architecture put in place could start to produce a poor user experience. A potential solution would be to scale 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.
Over time your application may experience performance issues. This can be caused by high traffic volume, memory consumption, or taxing the CPU from complex logic. 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 will allow you a quick, simple way to add more performance to your application or split that high traffic volume with ease.
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 allow for an issue to occur and your application still remain accessible.
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 in Azure 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 and global access was a 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. 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.
When it comes to Scaling Up or Out, this is a decision that needs to be made based on a number of factors. If you are seeing very high traffic that is causing your application resources to spike, then Scaling Out is the right solution for you. 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. If you have low traffic activity but seeing resources peak to 100% then Scaling Up is the solution. Scaling Up allows you to quickly add more resources to your application to allow it to process normally under highly stressful executions.
In my experience, 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 to scale your application?
In this section we are going to walk through how easy it is to scale your application. Azure readily has several assets that can quickly and easily scale with a few clicks of a mouse. For this post we focus on 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 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 several different pricing tiers that can provide different 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 many options to choose from when making your decision. Azure SQL Databases have 3 tiers of performance: Basic, Standard, and Premium. Each tier can allow 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 slider to add/remove resources, and click Apply.
When it comes to Azure App Service the process is a 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.
Scale 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 is like creating multiple App Service that all live behind a Load Balancer. The scale out feature is available in two methods both of which will help you accomplish your goal of allowing your application to be more performant for your users.
Manual scale is just as it sounds. You are given a simple slider that will tell Azure how many active instances of your application you want available. Custom autoscale is where the magic really happens. 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 under “Metric Name” that will let you define upper limits for when your application should scale on its own!
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.