ArchitectMind
  1. Home
  2. Java Ecosystem
  3. Book 8 · Architecture Quality Attributes
  4. Volume IV
  5. Availability Calculation
Book 8 · Volume IV — Availability, Reliability & Resilience · Topic 1.2

Availability Calculation

99% · 99.9% · 99.99% · 99.999%

10 min readStage 3 · Systems10 interview questions
Chapter
Chapter 1 — Availability
Prerequisites
Topic 1.1
You will be able to
Convert any availability percentage into allowed downtime, compute availability from time or requests, combine serial and parallel dependencies, account for correlated failures, estimate composite availability of a real request path, and check whether a target is achievable
Covers
99% · 99.9% · 99.99% · 99.999%
On this page
  1. 1. Concept / Definition
  2. 2. Why It Exists
  3. 3. Core Concepts — The Nines in Minutes
  4. 4. How It Works Internally — Composition
  5. 4A. Deep Dive — Correlated Failures
  6. 5. APIs / Features / Syntax
  7. 6. Practical Examples
  8. 7. Common Problems & Mistakes
  9. 8. Performance & Production Considerations
  10. 9. Architecture & Design Considerations
  11. 10. Interview Questions & Answers

1Concept / Definition

Availability calculations turn percentages into minutes, and dependency diagrams into a composite number. The core formulas:

QuantityFormula
Time-basedA = (T − downtime) ÷ T
Request-basedA = good ÷ valid
Allowed downtime(1 − A) × T
Serial dependenciesA = A₁ × A₂ × … × Aₙ
Parallel (N redundant copies)A = 1 − (1 − Aᵢ)ᴺ
From MTBF/MTTRA = MTBF ÷ (MTBF + MTTR)
Table 1 — Formulas
Availability formulas
Figure 1 — Availability formulas

2Why It Exists

Targets like "99.99%" are meaningless until converted to minutes and checked against the architecture. Calculations reveal that a chain of ten 99.95% services can't deliver 99.99%, and show where redundancy buys the most.

Allowed downtime per year
Figure 2 — Allowed downtime per year

3Core Concepts — The Nines in Minutes

Downtime allowed by availability target
Figure 3 — Downtime allowed by availability target

3.1 99%

AspectValue
Downtime3.65 days/year, 7.3 h/month, 14.4 min/day
TypicalSingle instance, manual recovery, business-hours support
Where acceptableInternal batch tools, dev environments
Table 2 — 99%

3.2 99.9%

AspectValue
Downtime8.76 h/year, 43.8 min/month, 1.44 min/day
TypicalMulti-AZ, auto-restart, on-call
WhereInternal apps, non-critical APIs
Table 3 — 99.9%

3.3 99.99%

AspectValue
Downtime52.6 min/year, 4.38 min/month, 8.6 s/day
TypicalNo SPOF, automated failover, progressive delivery
WherePayments, partner APIs (PayGrid)
Table 4 — 99.99%

3.4 99.999%

AspectValue
Downtime5.26 min/year, 26 s/month, 0.86 s/day
TypicalMulti-region active-active, cells, no human in recovery
WhereTelecom core, core banking switches, DNS
Table 5 — 99.999%

4How It Works Internally — Composition

Serial vs parallel composition
Figure 4 — Serial vs parallel composition
Composite availability vs serial dependencies
Figure 5 — Composite availability vs serial dependencies
Composition caseCalculationResult
3 serial services at 99.9%0.999³99.7%
2 redundant instances at 99% (independent)1 − 0.01²99.99%
2 redundant at 99% behind an LB at 99.99%0.9999 × 0.999999.98%
Service needing A and (B or B')A × (1 − (1 − B)²)depends
Table 6 — Examples

4ADeep Dive — Correlated Failures

Parallel formulas assume independent failures. In practice copies often fail together: same bad deploy, same AZ, same dependency, same config. Model this with a common-mode term:

A ≈ (1 − (1 − A_independent)ᴺ) × A_common

ScenarioIndependent estimateWith common mode (99.95%)
3 pods at 99%99.9999%≈ 99.95%
2 acquirers at 99.9% (shared network)99.9999%≈ 99.95%
Table 7 — The common-mode part usually dominates

Reducing common-mode failure — deploy waves, AZ independence, provider diversity — often gives more availability than adding copies.

5APIs / Features / Syntax

JAVA
// Availability calculator used in design reviews
final class Availability {
    static double serial(double... parts) {
        return Arrays.stream(parts).reduce(1.0, (a, b) -> a * b);
    }
    static double parallel(double each, int copies) {
        return 1 - Math.pow(1 - each, copies);
    }
    static double withCommonMode(double parallel, double commonMode) {
        return parallel * commonMode;
    }
    static Duration allowedDowntime(double a, Duration window) {
        return Duration.ofMillis((long) ((1 - a) * window.toMillis()));
    }
}
// Availability.allowedDowntime(0.9999, Duration.ofDays(30)) → PT4M19.2S
JAVAPROMQL
# Request-based availability over 30 days (recording rule for dashboards)
- record: slo:checkout_availability:30d
  expr: |
    1 - (
      sum(increase(http_server_requests_seconds_count{
            uri="/api/checkout", status=~"5.."}[30d]))
      /
      sum(increase(http_server_requests_seconds_count{
            uri="/api/checkout", status!~"4.."}[30d]))
    )
AWS SLA inputs (typical published values)Commitment
EC2 (multi-AZ region-level)99.99%
ALB99.99%
Aurora Multi-AZ99.99%
ElastiCache Multi-AZ99.99%
S3 Standard99.9% (availability), 11 nines durability
Table 8 — SLAs are floors for credits, not predictions — use measured data where you have it

6Practical Examples

6.1 ShopNow checkout path

Checkout path composition
Figure 6 — Checkout path composition
Dependency (serial)Measured monthly
Edge + ALB99.995%
Checkout pods (multi-AZ)99.99%
Aurora99.99%
Valkey state99.98%
Payments (2 acquirers)99.97%
Composite≈ 99.92%
Table 9 — Target was 99.95% — the model showed Valkey and payments had to improve
ChangeNew valueComposite
Valkey: replicas + fast failover, degraded cart mode99.995%99.935%
Payments: health-based routing between acquirers99.99%99.955%
Table 10 — Target reached by fixing the two weakest serial dependencies

6.3 PayGrid 99.99% feasibility

Serial dependencies in a cellAvailability
Global Accelerator + regional router99.995%
Gateway + services99.995%
Aurora (cell)99.99%
Acquirer network (multi-provider)99.995%
Composite≈ 99.975% — below 99.99%
FixAsync acceptance for payments when acquirers are degraded (202 + webhook), removing acquirers from the synchronous availability path
Table 11 — The target forced an architectural change

6.4 Worked example — converting targets

Target30-day windowRolling 7 days
99.95%21.6 min5.0 min
99.99%4.3 min1.0 min
Table 12 — Know the window when reporting

6.5 Worked example — MTBF/MTTR view

ServiceMTBFMTTRA
Checkout47 days13 min99.98%
Legacy ERP200 days6 h99.88%
Table 13 — Same formula, different levers (Chapter 2)

6.6 Worked example — parallel paths with a shared LB

SetupCalculationA
2 acquirers at 99.9% each, independent1 − 0.001²99.9999%
Plus router at 99.995% in series× 0.9999599.995%
Plus common-mode (shared card network) 99.99%× 0.9999≈ 99.985%
Table 14 — The shared parts set the ceiling

6.7 Worked example — interview whiteboard

PromptAnswer outline
"Can our service be 99.99%?""Convert: 4.3 minutes a month. List synchronous dependencies and multiply their measured availabilities; if the product is below target, raise the weakest links with redundancy (1 − (1 − A)ᴺ, minus common-mode failures) or take them off the synchronous path. Also check MTTR — automated recovery in seconds is needed at four nines."
Table 15 — Structured answer

6.8 Worked example — async removes a dependency from the availability path

DesignSynchronous chainComposite
Sync email in checkoutpods × DB × email provider (99.9%)≈ 99.88%
Outbox + async emailpods × DB≈ 99.98% (email availability becomes timeliness SLO)
Table 16 — Moving work off the request path raises availability arithmetically

6.9 Worked example — optional dependencies

DependencyRequired?Effect on availability
RecommendationsOptional (80 ms deadline, hidden on failure)Not in the product
Reviews summaryOptional (cached fallback)Not in the product
PricingRequiredIn the product
Table 17 — Only required dependencies multiply — design everything else as optional

6.10 Worked example — availability per year vs per month

Monthly availability patternAnnual availability
11 months at 100%, 1 month at 99.5% (3.6 h outage)≈ 99.96%
Every month 99.96%99.96%
Contract measured monthly at 99.95%First pattern breaches one month; second never does
Table 18 — The same annual number can hide very different experiences

6.11 Worked example — k-of-n availability

When a system needs k of n copies working (e.g., a quorum of 2 of 3), availability is the probability that at least k are up:

Setup (each copy 99.9%)FormulaAvailability
1 of 3 needed1 − (0.001)³≈ 99.9999999%
2 of 3 needed (quorum)p³ + 3p²(1 − p)≈ 99.9997%
3 of 3 neededp³99.7%
Table 19 — Quorum systems trade some availability for consistency

6.12 Worked example — availability of a multi-step journey

StepAvailability
Load app / home99.97%
Search99.97%
Product page99.99%
Add to cart99.98%
Checkout + pay99.93%
Journey (all steps)≈ 99.84%
Table 20 — Users experience the product of every step they need

7Common Problems & Mistakes

MistakeFix
Ignoring serial dependenciesMultiply the chain
Assuming independent redundancyAdd common-mode terms
Using vendor SLAs as predictionsUse measured data
Mixing windows (month vs rolling)State the window
Forgetting latency in "good"Include thresholds
Targets above dependency ceilingRedesign or lower target
Table 21 — Mistakes and fixes

8Performance & Production Considerations

ConsiderationPractice
Recording rules30-day and 7-day availability per SLI
Dependency dashboardsMeasured availability of each dependency
Design reviewsAvailability calculation required for Tier 0/1
ContractsSLA targets below internal SLO
Table 22 — Operating calculations

Calculations are only useful if their inputs are measured continuously. Record request-based availability for every SLI as Prometheus recording rules over both 30-day and seven-day windows, and record the measured availability of each dependency, not just of your own service, so composite models use real numbers. Make an availability calculation a required section of design reviews for Tier 0 and Tier 1 services, with the dependency chain, common-mode assumptions and expected MTTR stated. Recompute it whenever a synchronous dependency is added, because one extra call can silently remove a nine. When writing contracts, set external SLA targets below the internal SLO, for example a 99.9% SLA against a 99.95% SLO, so normal variation does not trigger penalties and the team gets warning before a breach.

9Architecture & Design Considerations

GuidelineDetail
Minimise synchronous dependenciesEach lowers availability
Make redundancy independentAZs, providers, deploy waves
Move non-critical work off the pathAsync, optional features
Budget availability per dependencyTopic 1.4
Table 23 — Design guidance

10Interview Questions & Answers

Q1L1 · BasicEstimation

How much downtime does 99.9% allow per year?

About 8.76 hours a year. Allowed downtime is (1 − A) × T: 0.001 of the 8,760 hours in a year gives 8.76 hours, which is about 43.8 minutes a month or 1.44 minutes a day. It is worth knowing the neighbours too: 99% allows 3.65 days a year, 99.99% about 52.6 minutes and 99.999% about 5.26 minutes. The real point is what 99.9% implies operationally. It is achievable with Multi-AZ deployment, automatic restarts and an on-call engineer who can respond within minutes, but it leaves no room for long maintenance windows or a manual recovery that takes several hours.

Q2L1 · BasicEstimation

And 99.99% per month?

About 4.4 minutes a month. Unavailability is 0.0001, and a 30-day month of 43,200 minutes multiplied by 0.0001 gives 4.32 minutes, or 4.38 minutes for an average month of 30.4 days. Always state the measurement window, because the number changes with it: a rolling seven-day window allows only about one minute. At four nines, a single incident per month that needs a human to wake up, log in and diagnose already uses the whole budget, so the architecture needs no single points of failure, automated failover within seconds, and progressive delivery that rolls back bad deploys before most users notice them.

Q3L2 · IntermediateConcept

How do serial dependencies combine?

Multiply their availabilities: A = A1 × A2 × … × An, because a request succeeds only if every dependency on the synchronous path is up at the same time. Each serial dependency therefore lowers the total, and the composite is always below the weakest link. Three services at 99.9% give 0.999³, about 99.7%. ShopNow's checkout path, with edge, pods, Aurora, Valkey and payments, multiplies to about 99.92%, below its 99.95% target. The formula assumes independent failures and counts only required dependencies; optional features with fallbacks, and work moved to asynchronous processing, drop out of the product, which is why minimising synchronous dependencies is so effective.

Q4L2 · IntermediateConcept

How do redundant copies combine?

For N redundant copies where any one can serve the request, availability is 1 − (1 − A)ᴺ: you multiply the unavailabilities, because the service is down only when every copy is down at once. Two independent instances at 99% give 1 − 0.01², which is 99.99%. The formula assumes independent failures and instant, reliable failover, both of which are optimistic. Copies usually share something, such as a deployment, AZ, configuration or upstream network, so add a common-mode term in series. Remember also that the redundant group still sits behind a load balancer or router, which is itself a serial dependency and caps the result.

Q5L3 · Senior EngineerTricky

Why is redundancy often less effective than calculated?

Because the copies rarely fail independently. The parallel formula assumes each copy fails for its own reasons, but in practice they share a deployment pipeline, a configuration, an AZ, a dependency or a network, so one event takes them all down together. Three pods at 99% look like six nines on paper, yet a bad deploy rolled to all three gives about 99.95%. Two acquirers that share a card network behave the same way. Failover is not instant either: detection and switching consume minutes. Model a common-mode term in series, and reduce it with deploy waves, AZ independence, provider diversity and regularly tested failover.

Q6L3 · Senior EngineerConcept

How do you compute availability from MTBF and MTTR?

Availability equals MTBF divided by the sum of MTBF and MTTR, where MTBF is the mean time between failures and MTTR the mean time to restore. It expresses availability as the fraction of time spent working. ShopNow's checkout fails about every 47 days and recovers in 13 minutes, giving roughly 99.98%; a legacy ERP failing every 200 days but taking six hours to recover reaches only about 99.88%. The formula shows the two levers: fail less often, or recover faster. For high targets, cutting MTTR through fast detection, automated rollback and failover is usually cheaper and more reliable than trying to prevent every failure.

Q7L4 · Technical ArchitectTricky

Should you use AWS SLAs in calculations?

Only as floors, not as predictions. A provider SLA is a commercial commitment about when you receive service credits, typically 99.99% for EC2 across multiple AZs, ALB and Aurora Multi-AZ. Real availability is often higher, but the SLA says nothing about how your configuration, client timeouts, retries or failover behave, and credits never cover your business losses. Use the measured availability of each dependency from your own SLIs and synthetic checks wherever you have data, and use SLAs for new services or as a pessimistic bound. Also check what each SLA measures, such as region level versus instance level, because the definitions differ.

Q8L4 · Technical ArchitectScenario

Your chain computes 99.92% but the target is 99.95%. What now?

Find the weakest serial links and either strengthen them or take them off the synchronous path. List each dependency's measured availability; ShopNow's 99.92% came mainly from Valkey at 99.98% and payments at 99.97%. Valkey got replicas, faster failover and a degraded cart mode, reaching 99.995%. Payments got health-based routing between two acquirers, reaching 99.99%, and the composite rose to about 99.955%. Other levers include making a dependency optional with a fallback, or moving it to asynchronous processing. Only if those options are too costly should you negotiate the target down with the business, with the impact of the lower target quantified.

Q9L5 · Solution ArchitectEstimation

How do you check a 99.99% target is achievable?

Turn the target into minutes, then test the design against them. 99.99% allows about 4.3 minutes a month. List every synchronous dependency, multiply their measured availabilities and include common-mode failures such as shared deploys, AZs and networks. If the product is below the target, the design cannot meet it as drawn. Then check MTTR: at four nines, recovery must be automated and happen in seconds, because a single manual incident consumes the whole month's budget. PayGrid's cell computed to about 99.975% with acquirers on the synchronous path, so the design changed to asynchronous acceptance with webhooks whenever acquirers are degraded.

Q10L5 · Solution ArchitectDesign

What design choice most improves composite availability?

Reducing the number of synchronous dependencies, then making the remaining ones independently redundant. Every required dependency multiplies into the total, so removing one is often worth more than improving several. Move non-essential work, such as emails, analytics and notifications, onto asynchronous paths with an outbox. Make features like recommendations and reviews optional, with deadlines and fallbacks, so their failures degrade the page instead of failing it. For dependencies that must stay, add redundancy whose failures are truly independent: separate AZs, deploy waves and provider diversity. At ShopNow, moving email off checkout raised that path from about 99.88% to 99.98% by arithmetic alone.

Test your knowledge on this topic →Flashcards from this topic's 10 questions, filtered by level and type.

Free question pack

Get 100 free Core Java interview questions

Subscribe for the Book 1 question pack (PDF, every answer explained) and new tutorials once a week. No spam, unsubscribe anytime. What is in the pack?

Almost done! Check your inbox and click the confirmation link. Your download link arrives as soon as you confirm.