Search Sreeni's Insights

Filter by content type
cloud May 9, 2019 8 min read

How to define a DR strategy for your application? A worked example - Part 5

Define a DR strategy for your application with a worked example: the process to identify the strategy, a worked example and the DR lifecycle.

Share:

How to define a DR strategy for your application? A worked example - Part 5

Knowing the patterns and the resource options is not enough; a team needs a repeatable process to go from “we need DR” to a strategy which is implemented, monitored and practiced. Without a process, the decisions are made on gut feeling, the plan lives in one person’s head and nobody knows whether it works until the day it is needed. In the previous article, we discussed the resource wise DR guidelines, the implementation patterns and the thumb rules. In this last article of the series, we are going to see the end-to-end process to define a DR strategy and apply it to an example application, along with the DR lifecycle.

DR Guidelines series:

  1. What is resiliency and why do we need a DR strategy?
  2. How to measure resiliency? RTO, RPO, MTTR and SLA
  3. What are the DR strategy patterns and how to choose one?
  4. How to implement DR for Azure resources?
  5. How to define a DR strategy for your application? A worked example (this article)

TL;DR Summary

  • The process has three stages: analyze (systems, failures, RTO/RPO, SLA, strategy), implement (regions, architecture, automation, monitoring) and operate (failure mode analysis, smoke tests, MTTR tracking, drills, champions).
  • Identify all critical systems and their dependencies first; the DR strategy is decided per system, not per team.
  • Active-passive is our recommended strategy, with West Europe as the primary region and North Europe as the secondary.
  • Automate the DR setup, failover, failback and alerts, and trigger an automated smoke test on every failover and failback.
  • The DR lifecycle is Healthy → Failover → Failback → Healthy; track an incident from failover to failback.
  • Perform DR drills at regular intervals with a trained DR champion and deputy champion.

Process to Identify the DR Strategy

The process has 19 steps in three stages. First we analyze the application and choose the strategy, then we implement it, and finally we operate and practice it. Let us see each stage.

Stage 1: Analyze

In this stage, we understand the application and decide what we need. The output is a chosen DR strategy backed by the RTO, RPO and SLA.

StepActivityWhat to do
1Identify all critical systemsList the dependent components or systems and the communication flow between them
2Identify the potential failures of each system or componentUnderstand the business impact of the application failures, the severity level, the area of impact and the failure possibilities
3Define the RTO and RPODefine them for each system or component
4Define the SLADefine it for the whole application
5Choose a DR strategyActive-passive is recommended

Stage 2: Implement

In this stage, we build the DR as designed. Automate everything, so the DR setup, failover, failback and alerts don’t depend on a person.

StepActivityWhat to do
6Identify the two regions to implement DRIn our case, West Europe is the primary and North Europe is the secondary
7Define the DR architectureBased on the chosen strategy
8Define the implementation stepsWrite down the steps in order
9Implement the DRAutomate everything (i.e. DR setup, failover, failback and alerts)
10Set up the monitoring tools to monitor and alertUse Application Insights availability tests, custom events and alerts, and Log Analytics for the infrastructure level logs and alerts (i.e. VM heartbeats). Use both systems to trigger the automatic failover in special cases
11Create an incident in the event of failoverClose it on failback

Stage 3: Operate

In this stage, we keep the DR healthy and practiced. A DR plan which is never tested is only a document.

StepActivity
12Do a failure mode analysis, identify the cause and document it
13Trigger an automated smoke test whenever there is an event of failover or failback
14Record and track the MTTR and SLA for each incident
15Document all automated and manual processes, if any
16Create a backup and testing plan, and the scenarios under which the testing was performed
17Perform DR drills at regular intervals
18Choose a DR champion and a deputy champion, and train them to execute the plan
19Update the plan and track if there is any deviation

Worked example

Let us apply the process to an example application. The numbers below use the guidelines from the previous articles; replace them with your own while you follow along. The RTO and RPO values are based on the architectures given in the previous articles, so for a different architecture they will vary and you must validate them for your own.

Step 1: Identify the critical systems

Assume we have a customer facing portal with the following components,

ComponentAzure resourceUsed for
Web App/APIApp Service (Standard or above)Portal UI and API
DatabaseSQL Managed Instance (General Purpose or above)Transactional data
File storeStorage Account (V2, ZRS or above)Documents and static data files
CacheRedis Cache (Standard or above)Session and lookup data

The communication flow is: user → Cloudflare → Traffic Manager → Web App/API → SQL MI, Storage and Redis Cache.

Step 2: Identify the potential failures

ComponentPotential failureBusiness impactSeverity
Web App/APIInstance or region failurePortal not available for all usersCritical
SQL MIRegion failure or data corruptionPortal not available, possible data lossCritical
Storage AccountRegion failureDocuments not availableHigh
Redis CacheCache failureSlower responses, sessions lostMedium

Step 3: Define the RTO and RPO

Assume the business agreed on an RTO of 30 mins, which is our recommended target for the Web App/API, and an RPO of 5 seconds for the transactional data.

Step 4: Define the SLA

From Part 2, the infrastructure composite SLA of these four resources is 99.83%. Let us calculate the overall SLA for three candidate strategies, assuming 2 outages in a year,

StrategyRTO per outageDowntime (2 outages)Application SLAOverall SLADowntime per year
Redeploy2 hours4 hours99.95%99.78%~19.3 hours
Active-passive (auto failover)1 hour2 hours99.98%99.81%~16.6 hours
Active-passive (manual failover by Azure Automation)10 mins20 mins99.996%99.83%~14.9 hours

We can read two things from this table. First, only Active-passive with manual (automated) failover meets the 30 mins RTO, since Redeploy and auto failover both take longer than the target for each outage. Second, once the RTO is low, the overall SLA is limited by the infrastructure composite SLA (99.83%). To improve it further, we need more redundancy within the region (like zone redundancy and replicas), not a faster DR.

Note: This calculation is conservative. It multiplies the composite SLA of a single region with the application SLA, which treats a region outage and its failover as separate downtime.

Step 5: Choose the DR strategy

Based on the RTO, RPO and SLA, we choose Active-passive with manual failover by Azure Automation (see the architecture in Part 3).

Steps 6 to 11: Implement

The implementation decisions for our example are,

AreaDecision
RegionsWest Europe as the primary and North Europe as the secondary
ArchitectureWeb App/API in both regions (secondary in warm state), SQL MI with a failover group, Storage with RA-GRS, Redis Cache in both regions, and Traffic Manager in front
AutomationThe same ARM template spins up both regions. Traffic Manager triggers an Azure Automation runbook which fails over the SQL MI failover group, and the DBA is informed since they own the SQL MI failover
MonitoringApplication Insights availability tests on the health endpoint of both regions, Log Analytics alerts for infrastructure, and critical alerts to the on-call team
IncidentAn incident is created automatically on failover and closed on failback

Steps 12 to 19: Operate

After each failover, do a failure mode analysis and document the cause. The automated smoke test runs on every failover and failback, and we record the actual MTTR for each incident and compare it with the 30 mins RTO. Run a DR drill at a regular interval, led by the DR champion with the deputy champion, and update the plan with what you learn.

DR Lifecycle

The following diagram depicts the lifecycle of an application under a DR strategy.

DR lifecycle - Healthy, Failover and Failback states
DR lifecycle - Healthy, Failover and Failback states
StateWhat happens
1. HealthyThere are no health issues, and the primary region serves the traffic. Monitoring keeps checking the health endpoints
2. Health failsWhen the health checks fail, the failover is triggered: the traffic and the data stores are switched to the secondary region, an incident is created and the smoke test runs
3. Not recoveredWhile the primary region has not recovered, the application keeps running from the secondary region
4. RecoveredOnce the primary region has recovered, we fail back: the data is synchronized back to the primary, the traffic is switched back and the smoke test runs again
5. Back to healthyThe application is healthy again in the primary region, the incident is closed, and the MTTR and SLA are recorded

Must Consider: Plan and automate the failback as carefully as the failover. Failback is often forgotten, and a manual failback after a long incident is when mistakes happen.

Wrap up

In this article, we have looked at the end-to-end process to define a DR strategy, applied it to an example application from identifying the critical systems to choosing and operating Active-passive, and the DR lifecycle. With this, we have completed the DR guidelines series: from the foundations of resiliency, the metrics, the strategy patterns and the resource wise guidelines, to the process with a worked example. I really appreciate that you took the time to read this series. I hope it helps you to be proactive and have a tested plan before the next outage, not after it.

Related Posts