MSAZ-282 · Lesson 4 of 12 · 22 min
High availability concepts: RPO and RTO
▶ Video coming soon A video version of this lesson is on the way.
Elena starts the second part of the course with a question rather than a technology. "If StockLine stopped at ten o'clock on a Saturday morning in May," she asks the clinic, "how long could the stores keep selling, and how much of the morning's data could we afford to lose?" Walt answers at once: the tills can sell offline for about an hour, but after that they cannot check stock or prices for special orders, and losing even a few minutes of sales would mean stock counts that no longer match the shelves. Keiko Tanabe, who runs reporting, answers differently for the sales history database: a day without it would be annoying, and data loss of a day could be reloaded from the stores. Those two answers are the whole of this lesson. Before choosing any technology, a DBA must know how much downtime and how much data loss each database can tolerate, because those numbers decide what to build and what it will cost.
Two numbers for every database
The recovery time objective, or RTO, is the longest time a service may be unavailable after a failure before the business is seriously harmed. The recovery point objective, or RPO, is the largest amount of data, measured as time, that may be lost. An RPO of 5 minutes means that after recovery, the database may be missing at most the last 5 minutes of changes before the failure. An RTO of 1 hour means that within an hour of the failure, users must be working again. The two are independent: a reporting database might accept a day of data loss but need to be back within an hour for a board meeting, while an archive might accept a week of downtime but no data loss at all.
Two related ideas often appear beside them. The service level agreement, or SLA, is Microsoft's commitment for the availability of a service over a month, with service credits if it falls short; it is not a promise that any single failure will be short. The service level objective that the business sets for itself is usually stricter and covers the whole application, not just the database. And there is the difference between high availability and disaster recovery. High availability keeps a database running through local failures, such as a failed server, disk or rack, usually automatically and within seconds or minutes, inside one region. Disaster recovery restores service after a larger event, such as a whole data center or region becoming unavailable, a serious human error or corruption, usually in another region and often with a decision by a person.
Where the RTO goes
An RTO is not the time a failover takes. It is the time from the failure to the moment users are working again, and the failover is usually only a small part of it. Someone, or something, must notice the failure. Someone must decide that this is a disaster rather than a blip, which on a Saturday morning means reaching the on-call person and possibly a manager. Then the recovery itself runs, applications reconnect, and someone checks that the data and the application are right. Walt measured each of these steps during an old server-room test, and his conclusion still holds: the technology was the fastest part.
Worked problem
Budgeting StockLine's one-hour RTO
The business has set StockLine's RTO at 60 minutes. The DBA team estimates: detection by alert, 5 minutes; reaching the on-call DBA and the duty manager and agreeing to fail over, 15 minutes; failover of the managed instance's failover group, about 5 minutes including DNS changes; application servers and tills reconnecting, 10 minutes; checking that stock levels and recent sales look right, 10 minutes. Does the plan fit, and how much margin is left?
Show solution
- Add the steps: 5 + 15 + 5 + 10 + 10 = 45 minutes.
- Margin: 60 − 45 = 15 minutes.
- The decision step, 15 minutes, is three times as long as the failover itself, so it is the best place to save time.
Answer: The plan fits with 15 minutes to spare. Writing down who can approve a failover, and when it may be done without approval, protects the margin better than any faster technology.
Setting objectives with the business
Recovery objectives are business decisions, not DBA decisions. The DBA's job is to ask the right questions and show the cost of each answer. Elena uses a short business impact interview for each system: what stops working when this database is down, who notices first, what it costs per hour (lost sales, staff idle, penalties, reputation), whether data lost in a failure can be recreated from somewhere else, and whether there are busy periods when the impact is much higher. The answers are grouped into a few tiers, because a handful of standard designs is easier to build, test and explain than a custom design for every database.
| Tier | RPO | RTO | Harrow & Finch databases | Typical design |
|---|---|---|---|---|
| Tier 1: mission critical | 5 minutes or less | 1 hour | StockLine, Pricing | Business Critical, zone redundant, failover group to East US 2 |
| Tier 2: business important | 1 hour | 4 hours | Finch Rewards, store scheduling | Zone-redundant General Purpose, geo-replication or failover group |
| Tier 3: can wait | 24 hours | 24 hours | SalesHistory, finance archive | Geo-redundant backups and geo-restore |
| Vendor system | 15 minutes | 2 hours | Warehouse WMS | Availability group on VMs, asynchronous replica in the paired region |
The cost of each minute
Lower RPO and RTO cost more. A standby database in another region doubles the compute bill if it is kept the same size, although a passive disaster-recovery replica that is used only for failover can be exempt from SQL Server license charges when it is designated as a standby under Microsoft's failover rights. Zone redundancy adds a smaller premium in General Purpose and none in Business Critical for SQL Database. Every option also costs people's time: designs must be tested, runbooks kept current and staff trained. The DBA's task is to show the business the cheapest design that meets the objective, and the next cheaper design and what it would give up.
Worked problem
Is the standby worth it?
Finch Rewards loses an estimated 2,400 dollars of sales and goodwill per hour when it is down. A regional outage long enough to need disaster recovery is assumed to happen, on average, once every 5 years and to last 8 hours if the team relies on geo-restore, against about 30 minutes with a failover group. A geo-secondary for the database would cost an illustrative 3,100 dollars a year. Compare the expected yearly loss avoided with the cost.
Show solution
- Hours saved per event: 8 − 0.5 = 7.5 hours.
- Loss avoided per event: 7.5 × 2,400 = 18,000 dollars.
- Expected events per year: 1 ÷ 5 = 0.2.
- Expected loss avoided per year: 0.2 × 18,000 = 3,600 dollars.
- Compared with the standby cost: 3,600 − 3,100 = 500 dollars a year in favor of the standby.
Answer: On these assumptions the standby is only just worth it, so the decision rests on judgment: a loyalty outage on a busy weekend would cost more than the average, which tips the case toward the failover group. The numbers frame the conversation rather than end it.
Availability, SLAs and composite systems
An SLA expressed as a percentage translates into minutes of allowed downtime. A 30-day month has 43,200 minutes. An SLA of 99.99 in every 100 allows about 4.3 minutes of downtime a month; 99.995 allows about 2.2 minutes; 99.9 allows 43.2 minutes. When an application depends on several services in a chain, all of which must be up, their availabilities multiply, so the whole is less available than any part. When services are redundant, so that either of two copies is enough, the chance that both are down at once is the product of their unavailabilities, and the whole is more available than either.
minutes = 30 * 24 * 60
def downtime(avail):
return (1 - avail) * minutes
chain = 0.9999 * 0.9995 * 0.9999 # database, app service, gateway all needed
print(f"Chain availability {chain*100:.3f} in 100, about {downtime(chain):.1f} minutes down a month")
pair = 1 - (1 - 0.9999) * (1 - 0.9999) # either of two regions is enough
print(f"Two independent regions {pair*100:.6f} in 100, about {downtime(pair)*60:.2f} seconds down a month")Chain availability 99.930 in 100, about 30.2 minutes down a month Two independent regions 99.999999 in 100, about 0.03 seconds down a month
What this code does
The program turns availability figures into expected minutes of downtime in a 30-day month. For a chain, where the database, the application service and the gateway must all be working, it multiplies the three availabilities, which gives a lower figure than any one of them. For a pair of regions where either one is enough, it multiplies the chances that each is down, which gives a much higher figure. The output shows why a chain of good services can still miss a target, and why redundancy helps so much.
The second result is optimistic, because two regions are rarely fully independent: a bad deployment, a shared identity service or a person's mistake can affect both. Walt notes that in the margin of his decision log. The SLA percentages themselves come from Microsoft's published service level agreements, which change over time and differ by tier and configuration, so the lesson that follows gives the current figures with their conditions rather than treating any number as permanent.
Hybrid and Azure-specific options
The study guide asks a DBA to evaluate HA and DR for hybrid deployments as well as Azure-only ones. During Project Skylight, Harrow & Finch will be hybrid for at least a year. Several designs span the boundary. The Managed Instance link replicates databases from SQL Server on premises to a managed instance, first for migration and, with SQL Server 2022 or later, as a disaster-recovery replica that can fail over to Azure and back. An Always On availability group can include an on-premises replica and an Azure VM replica. Backups to Azure Blob Storage from on-premises servers give an offsite copy for little effort. And Azure Site Recovery can replicate whole virtual machines, although for SQL Server the database-level options usually give better RPO.
| Option | Works with | Typical RPO | Typical RTO | Notes |
|---|---|---|---|---|
| Geo-restore from geo-redundant backups | SQL Database, Managed Instance | Up to about an hour | Hours | Cheapest; no standby |
| Active geo-replication | SQL Database | Seconds | Seconds to minutes | Per database, up to four secondaries |
| Failover group | SQL Database, Managed Instance | Seconds | Seconds to minutes | Groups databases; listener names stay the same |
| Availability group on VMs | SQL Server on Azure VMs | Zero (synchronous) or seconds | Seconds | Customer builds and patches |
| Managed Instance link (DR) | SQL Server 2022+ and Managed Instance | Seconds | Minutes | Hybrid; supports failback to SQL Server 2022 or later |
| Log shipping | SQL Server on VMs and on premises | Minutes | Minutes to hours | Simple, manual role change |
Recovery objectives also change over time. StockLine's RTO was four hours in 2015, before the stores began selling online with in-store pickup; it is one hour now because a web order that cannot be confirmed is a lost sale. Elena schedules a review of every tier each year with the business owners, and whenever a system takes on a new role.
Common mistakes
MistakeRTO is the time a failover takes.
InsteadRTO runs from the failure until users are working again, including detection, decision and checks.
MistakeA 99.99 SLA means a failure will never last more than a few minutes.
InsteadAn SLA is a monthly availability commitment with service credits, not a limit on any one outage.
MistakeThe DBA sets the recovery objectives.
InsteadThe business sets them; the DBA shows the options and their costs.
MistakeChaining highly available services keeps the overall availability as high as the best one.
InsteadAvailabilities multiply in a chain, so the whole is lower than any part.
Summary and key terms
- RPO is the data loss a business can accept, measured as time; RTO is the downtime it can accept.
- High availability handles local failures automatically; disaster recovery handles regional events and serious errors, often with a person deciding.
- Most of an RTO is spent detecting, deciding and checking, not in the failover itself.
- Group databases into a few recovery tiers agreed with the business and match each tier to a standard design.
- Convert SLAs to minutes per month, and remember that chained services multiply their availabilities.
- Hybrid designs include the Managed Instance link, availability groups across sites and backups to Azure storage.
- RPO
- Recovery point objective: the most data, measured in time, that may be lost in a failure.
- RTO
- Recovery time objective: the longest a service may be unavailable after a failure.
- SLA
- Service level agreement: a provider's monthly availability commitment, backed by service credits.
- High availability
- Keeping a service running through local failures, usually automatically.
- Disaster recovery
- Restoring service after a large event, such as the loss of a region, usually elsewhere.
- Recovery tier
- A group of systems that share recovery objectives and a standard design.
Practice problems
Work each problem on paper first, then reveal the answer to check.
A database must lose no more than 15 minutes of changes. Which objective does that describe?
Show answer
The RPO.
Name two steps of an RTO besides the failover itself.
Show answer
For example: detecting the failure, deciding to fail over, reconnecting applications or checking the data.
About how many minutes a month does a 99.9 SLA allow in a 30-day month?
Show answer
About 43.2 minutes.
Why are recovery tiers useful?
Show answer
A few standard designs are easier to build, test and explain than one per database.
Which hybrid option can fail over from SQL Server 2022 to Managed Instance and back?
Show answer
The Managed Instance link.
Lesson quiz · 5 questions
Score 60% or more to complete this lesson.
Create a free account to save your progress, take quizzes and earn a certificate.