How to design apps for the cloud

It can be tempting to just move traditional, on-premises applications to the cloud as is, without overhauling their architecture. Often, this can be the quickest, efficient way to get applications to the cloud.


Cloud computing application design | Binary Tree
But then what happens if you miss out on the power of the cloud. Your applications will keep working pretty much as they did on premises, without the modern capabilities the cloud brings, like higher resilience and availability. So if you’re truly on a quest to modernize your applications, you’ll want to re-design them to be cloud-native. Here’s what these types of applications look like.

Scale out, not up

To increase the load of an on-premises application, the traditional way is to scale it up. This means physically adding more CPU power, memory, or storage to an existing server. But in the cloud, you don’t need to scale up—you can scale out to new servers that run on virtual machines. Not only is this process easier and faster, it also helps your applications stay available and be more resilient against failure. Plus, you get the ability to tweak server resources to optimize costs across Azure pricing tiers.

Handle faults gracefully

All software fails at some point or another. For example, there might be times when your application can’t connect to a database or server. Or when there’s an isolated network outage on a single virtual machine. It’s hard to anticipate these types of transient faults, so there’s no way to prevent failure 100% of the time. But what you can do is control how your application responds to issues. You can code your application in such a way that it gracefully handles as many types of errors as possible. Examples:

  • Retry logic: When a call to an external service fails, the application can use retry logic to re-initiate making the service call one or more times before throwing an exception.
  • Caching: You can also set up an application to cache a user’s request using some type of message queue. This lets users keep on working while the system handles the error and does the requested work in the background.

Deploy easily to many zones and regions

For on-premises applications, it can often be quite costly to build out your own datacenters in several places for redundancy, resiliency, and compliance. But in the cloud, you can deploy your applications to existing Azure regions around the world. You can also take this a step further and deploy applications to specific availability zones within each region. That way, you can control exactly which data center your application lives in. All of which can help you stay compliant with local regulations, plus deliver much higher resiliency and availability than you could on-premises.

Write to shared storage

When you host applications on a cloud service like Azure App Service, it’s important that the application not write anything persistent to its local file system. Reason being, multiple application instances hosted on different VMs won’t share the same local file system. So instead of writing things locally, make sure that applications write files and data to a shared storage service like Azure Blob Storage or Azure Redis Cache.

Use a stateless design

When you’re designing an application to scale out instead of up, it can be hard to have it share state across instances. So the trend these days is, where possible, to design applications to be stateless. For a web-based application, this might mean using cookies. Or for applications that absolutely need to share state across instances, you can use a cache service like Azure Redis Cache.

Go serverless

In serverless computing, you abstract your servers, infrastructure, and operating systems. When you build serverless apps, you no longer need to manage and provision your own servers—someone else takes care of that part for you. This means that you spend more time building and deploying great apps. For more, see Azure Functions.

Leverage PaaS services

Instead of building your own services to complete certain tasks, you can grab ready-made services in Azure. These standard services are already designed to deliver the availability, performance, security, and scale required by Microsoft’s most demanding customers. So you save significant work while providing a service level that would be difficult and expensive to match. And when you use services that are built for the cloud, your development team can save significant time, while adding much more value. Maybe even in areas where they don’t have the expertise of their own. For more about the benefits of PaaS, see Top 7 reasons to modernize applications with Azure.

Get started

Ready to update your apps to take advantage of the power of the cloud? We at Binary Tree are standing by. We’re exclusively focused on helping enterprises around the world plan, move, and manage their way to the Microsoft cloud. To get started, get in touch.

 

Source: Microsoft. Cloud Migration and Modernization Playbook. 2018.