Find a course

Module 3: Reliability and ScaleLesson 7 of 1212 min

High Availability, Redundancy and Autoscaling

Translate availability percentages into downtime, calculate how redundancy and dependencies change availability, and design apps that scale automatically.

Step 1 of 12Learn

Everything fails, all the time

A well-known saying among cloud engineers, often credited to Amazon's CTO Werner Vogels, is "everything fails, all the time." At cloud scale it's simply arithmetic: with millions of disks, some fail every hour. Power supplies die, network links get cut, software updates go wrong. The question isn't whether a component fails but what happens to your application when it does.

Availability is the percentage of time a system is working and reachable. It's usually described in "nines":

AvailabilityDowntime per yearDowntime per 30-day month
99% ("two nines")about 3.65 daysabout 7.2 hours
99.9% ("three nines")about 8.8 hoursabout 43 minutes
99.99% ("four nines")about 53 minutesabout 4.3 minutes
99.999% ("five nines")about 5.3 minutesabout 26 seconds

The formula is simple: downtime = (1 − availability) × time period. A year has 8,760 hours, so 99.9% allows 0.001 × 8,760 = 8.76 hours.

Each extra nine costs significantly more to achieve, so the right target depends on the business. An internal reporting tool might be fine at 99.5%; a payment system may need 99.99%. Cloud providers publish SLAs (service level agreements) promising a certain availability for each service, with service credits if they miss it. Credits rarely cover your actual losses, though, so an SLA is not a substitute for designing your own resilience.

Step 2 of 12Try the calculator

Downtime calculator

Enter an availability percentage to see how much downtime it allows.

Downtime per year
8.76 hours
Downtime per year
525.6 minutes
Downtime per 30-day month
43.2 minutes

Step 3 of 12Practice · Work it out

A service has an availability target of 99.95%. How many hours of downtime does that allow per year (8,760 hours)? Round to two decimal places.

Step 4 of 12Learn

Chains and redundancy

Real applications depend on several components at once: a load balancer, web servers, a database, a DNS service. The math of combining them explains most cloud architecture decisions.

Components in series (all must work) multiply: if a web server is 99.9% available and the database it depends on is also 99.9%, the pair is 0.999 × 0.999 ≈ 99.8%. Every additional required component lowers the total. A chain is weaker than its weakest link.

Redundant components in parallel (any one is enough) work the other way. The system fails only if all copies fail at the same time. With each copy at availability a and n independent copies:

availability = 1 − (1 − a)n

Two independent servers at 99% each give 1 − 0.012 = 99.99%. That's the power of redundancy: two "two nines" components make a "four nines" pair, as long as their failures really are independent.

That last condition is the catch. Two servers in the same rack share the same power supply and switch, so they tend to fail together. That's why cloud designs spread copies across availability zones: separate power, cooling and networking make simultaneous failure far less likely.

The design goal is to remove every single point of failure (SPOF): any component whose failure takes the whole system down. Common SPOFs are a single database server, one NAT gateway, a single VPN tunnel, or one person who knows the admin password.

Step 5 of 12Diagram

A chain is weaker than its links

A chain is weaker than its linksProcess diagram: DNS: 99.99% → App tier: 99.9% → Database: 99.9% → Whole app: about 99.79%.DNS: 99.99%App tier: 99.9%Database:99.9%Whole app:about99.79%

Tap a shape with to see more.

Components in series multiply: the total is always lower than the weakest link.
DNS: 99.99%
App tier: 99.9%
Database: 99.9%
Whole app: about 99.79%

0.9999 × 0.999 × 0.999 ≈ 0.9979, or roughly 18 hours of downtime a year.

Step 6 of 12Explore

Redundancy explorer

The chart shows the availability (%) of a group of independent, redundant copies as the number of copies grows. Change the availability of a single copy and see how quickly redundancy adds nines.

9092949698100 12345
One copy
99 %
Two copies in parallel
99.99 %
Three copies in parallel
99.9999 %

Step 7 of 12Practice · Work it out

An app needs a load balancer (99.99%), a web tier (99.95%) and a database (99.9%), all in series. What is the combined availability, as a percentage rounded to two decimal places?

Step 8 of 12Learn

Autoscaling and designing for failure

Autoscaling adds and removes instances automatically based on rules, keeping enough capacity for the current load without paying for peak capacity all day. A typical setup:

  • An autoscaling group with a minimum (say 2, one per zone, so there's always redundancy), a desired count and a maximum (say 20, to cap costs).
  • A scaling policy: keep average CPU around 60%, or keep requests per instance below a target. When load rises, the group launches instances; when it falls, it terminates them after a cooldown.
  • Health checks: unhealthy instances are replaced automatically, so autoscaling also provides self-healing.
  • Scheduled scaling for predictable patterns, such as adding capacity before 9 a.m. on weekdays.

Autoscaling only works if the application is stateless: any instance can handle any request, because session data, uploads and other state live in shared services (a database, a cache, object storage) rather than on the instance's disk. If a user's shopping cart lives in one server's memory, terminating that server empties the cart.

Other habits of resilient cloud design: treat servers as disposable and rebuild them from automation instead of repairing them by hand; use retries with backoff when calling other services; use queues to absorb bursts so a slow component doesn't block everything; and test failure on purpose, for example by terminating instances in a test environment, to prove the system recovers.

Step 9 of 12Diagram

How autoscaling works

How autoscaling worksCycle diagram: Watch a metric → Compare with targets → Add or remove instances → Health checks.Every minuteor soWatch a metricCompare withtargetsAdd or removeinstancesHealth checks

Tap a shape with to see more.

Watch a metric

CPU, requests per second, queue length.

Compare with targets

For example, keep CPU near 60%.

Add or remove instances

Within a minimum and maximum you set.

Health checks

Unhealthy instances are replaced; the load balancer sends traffic only to healthy ones.

Step 10 of 12Practice · Select all that apply

Which changes remove a single point of failure? Select all that apply.

Select all that apply.

Step 11 of 12Note

Step 12 of 12Practice · What would you do?

What would you do?

An online store runs on one large VM in one availability zone, holding the web app, user sessions and uploaded product images. Black Friday is coming. What is the best plan?