Scrivio Interview library

High availability and disaster recovery

35 questions in 7 subtopics.

About this topic

High availability is the ability of a system to keep serving users while parts of it fail, and disaster recovery is how it comes back after a failure too large to absorb, such as the loss of a region or of data. Most production outages start with a lost zone, a bad deployment, a sudden spike or corrupted data, and whether they become a short blip or a long outage is usually decided by design work done in advance. This topic covers redundancy and failover across zones, active-active and active-passive designs across regions, recovery objectives and backups, load shedding and graceful degradation, safe deployments at scale, chaos engineering and game days, and handling traffic spikes. The questions move from how each idea works to real incidents with concrete symptoms, and to the cost and risk decisions senior engineers make.

Redundancy and failover

Redundancy means running spare copies of every component so one can fail without an outage, and failover is how traffic and state move to the survivors. Before answering, understand how much spare capacity a zone loss needs, the difference between hot, warm and cold standbys, why copies that share code, input or dependencies fail together, and why failover should rely on the data plane rather than on control-plane actions during an incident.

ConceptFoundations6 min read

Redundancy means running more copies of a component than the load needs, so one can fail without an outage. A web service needs 12 instances at its daily peak and runs in a region with three availability zones.

How many instances should it run, and where, to survive losing one zone at peak? What do N+1 and N+2 mean, and how do hot, warm and cold standbys differ in recovery time and cost?
DebuggingIntermediate6 min read

A search service runs 12 replicas across three zones behind a load balancer that retries a request on another backend when the connection is reset. At 03:12 all 12 replicas crash within 40 seconds; each log ends with java.lang.OutOfMemoryError: Java heap space while expanding a wildcard query.

The JVMs run with -XX:+ExitOnOutOfMemoryError. Why did redundancy give no protection here, and what changes stop one bad input from taking down the whole fleet?
ScenarioIntermediate6 min read

A shopping API runs 30 instances spread evenly over three zones at about 70 percent CPU at the evening peak. At 19:40 one zone loses its network. Autoscaling asks for 10 more instances in the other zones, but the provider's launch API is throttled and they arrive 25 minutes later.

What did the remaining 20 instances go through during those 25 minutes, and how would you redesign capacity and failover so that losing a zone does not depend on launching anything?
DesignAdvanced7 min read

A payments platform runs in three zones of one region. Requests often cross zones: a gateway in zone A calls a service in zone B, which reads a cache in zone C. A sick zone therefore hurts requests everywhere, and taking it out of service needs changes in many places.

Design the platform so that a degraded zone can be taken out of service quickly and safely, without relying on the cloud provider's control plane during the event.

Multi-region active-active and active-passive

Running in more than one region protects against the loss of a whole region. Active-passive keeps a standby region ready to take over; active-active serves traffic from several regions at once. Know the spectrum from backup and restore through pilot light and warm standby to active-active, the headroom each region needs, why writes are the hard part, and why standby regions decay unless they are exercised.

ConceptFoundations6 min read

Teams that must survive the loss of a whole cloud region choose among several patterns, from restoring backups elsewhere to serving live traffic from two regions at once. The patterns differ widely in cost, recovery time and possible data loss.

Compare backup and restore, pilot light, warm standby and active-active: what runs in the second region in each, typical RTO and RPO, and what makes active-active the hardest.
DebuggingFoundations5 min read

A booking service runs active-active in two regions, each handling half the traffic at about 65 percent CPU at peak. At 12:05 region A starts returning 30 percent errors, and at 12:10 the team moves all traffic to region B. By 12:15 region B is failing too.

Why did region B fail, and what should the capacity rule and the failover procedure have been?
ScenarioIntermediate6 min read

An e-commerce platform runs active-passive. The standby region keeps the full stack at 20 percent size, with databases fed by asynchronous replication. During a real outage of the primary region the team starts failover at 10:00; at 10:50 checkout is still failing in the standby.

What commonly makes a warm standby slow at the moment it is needed, and how would you make this failover reliably finish in under 15 minutes?
ScenarioAdvanced6 min read

A platform of 120 services runs active-passive across two regions. In a planned failover test, 110 services moved cleanly, but checkout failed in the second region for 40 minutes.

The causes were a singleton scheduler that only ran in the first region, a payment provider that allowlisted only the first region's egress IP addresses, and a document bucket that was never replicated. How do you find such region-pinned dependencies systematically across 120 services and keep new ones from appearing?
LeadershipPrincipal6 min read

Two years ago your company moved its core platform to active-active across two regions. Teams now fight write conflicts and consistency bugs, cloud cost is up 70 percent, and last year's two largest outages were global software and configuration failures that hit both regions.

Leadership asks whether to go back to active-passive. As the senior technical leader, how do you make this decision?

RPO, RTO and backups

The recovery point objective is how much data, measured in time, may be lost; the recovery time objective is how long recovery may take. Understand that real recovery time includes detection, decisions, restore, log replay and validation, that logical corruption usually calls for targeted repair rather than a full restore, and that backups are useless without the keys, images, tools and knowledge needed to restore them elsewhere.

ConceptFoundations6 min read

RTO is the longest acceptable time from an outage to restored service; RPO is the most data, measured in time, that may be lost. A team says its 2 TB order database has an RTO of one hour because restoring the last snapshot takes 40 minutes.

What does this claim leave out? Break a realistic recovery into its stages, estimate each, and say what decides the real RPO.
ScenarioIntermediate6 min read

A release at 08:00 introduced a currency-conversion bug in an order service: about 3 percent of orders written since then store a wrong total. It is found at 14:00, after six hours of valid writes from everyone else and refunds and shipments already based on the bad totals.

Why is restoring the database to 07:59 the wrong answer, and how would you recover?
DesignIntermediate6 min read

An order flow spans four services with their own PostgreSQL databases: orders, payments, inventory and shipping. Each has backups and point-in-time recovery. After a storage failure, the payments database can only be restored to 10:42, while the other three are intact up to 11:00.

What inconsistencies does this create, and how would you design the system so one service can be restored and then brought back in line with the others?
ScenarioAdvanced6 min read

A company tests its region-loss plan by restoring production into a second region from cross-region backup copies, treating the primary region as gone. The database copies are there, but the restore stalls for most of a day.

The team finds that the backups are encrypted with keys that exist only in the primary region, container images live in a single-region registry, and the infrastructure state files and runbooks are stored in the primary region. How do you redesign recovery so that everything it needs is available outside the failed region, and how do you prove it?
LeadershipPrincipal6 min read

A long power and network event in your main region forced a full restart of the platform. Recovery took nine hours: the secrets service needed its database, the database operator needed secrets, deployments needed the CI system, which needed the identity provider, and nobody knew the right order.

As the senior technical leader, how do you make a full cold start of the platform predictable, and keep it that way as hundreds of services change?

Load shedding and graceful degradation

When demand exceeds capacity, a service that accepts everything ends up serving nobody well. Load shedding rejects excess work early and cheaply, ideally by priority, and graceful degradation turns off less important features so core journeys keep working. Know how shedding differs from rate limiting and back-pressure, why long queues destroy useful throughput, and why degradation plans must be agreed and tested before they are needed.

ConceptFoundations6 min read

When more requests arrive than a service can handle, something has to give. Load shedding is a server deliberately rejecting part of the work early so that the rest is served well, instead of letting every request slow down together.

How does load shedding differ from rate limiting and back-pressure, why should rejected requests fail fast with a clear status, and what should a client do when it receives one?
CodingIntermediate7 min read

A Spring Boot service needs protection from overload. The team wants a servlet filter that caps the number of requests in progress, keeps some room for traffic marked critical, and rejects the rest quickly when the cap is reached.

Write a OncePerRequestFilter that allows 150 concurrent normal requests plus 50 reserved for requests with the header X-Priority: critical, returns 503 with Retry-After when full, and counts rejections with Micrometer. Explain the pitfalls.
DebuggingIntermediate7 min read

A Spring Boot service on Tomcat with 200 worker threads normally handles 1,500 requests per second at 40 ms. Clients time out after 2 seconds. During a promotion traffic reaches 2,500 requests per second, and thousands of connections wait for a free thread.

The service now completes 1,400 requests per second, yet clients report that almost every request fails with a timeout. How is that possible, and how do you fix it?
DesignAdvanced6 min read

A food delivery platform of 80 services has evening peaks and occasional overloads. Each service sheds randomly when overloaded, so placing an order is as likely to be dropped as a background refresh of restaurant ratings.

Design criticality-based load shedding across the platform: how requests are classified, how the class travels through service calls, and how each service decides what to drop.
LeadershipPrincipal6 min read

During last year's peak sale the site was overloaded for two hours. Engineers improvised: one turned off search suggestions, another disabled personalised pricing, and nobody knew whether turning off fraud checks was allowed. Revenue loss was large, and some changes caused new errors.

As the senior technical leader, how do you turn graceful degradation from improvisation into a planned capability that product, business and engineering agree on?

Safe deployments at scale

Most outages are caused by changes, so large platforms control how fast a change spreads. Understand rolling updates and the capacity they remove, feature flags that separate deploying from releasing, canary analysis and its blind spots, releases that stay reversible when data formats change, and deployment waves across cells and regions. The same safety must apply to configuration, flags and infrastructure, not only to code.

ConceptFoundations7 min read

Deploying puts new code onto servers; releasing exposes new behaviour to users. Feature flags are runtime switches in the code that let teams separate the two, turning behaviour on for some users, or off again, without a new deployment.

How do feature flags make changes safer at scale, which kinds of flags exist, and what risks do they bring?
DebuggingFoundations7 min read

A Spring Boot API runs 8 pods on Kubernetes at 60 percent CPU at midday. Its Deployment uses RollingUpdate with maxUnavailable: 25% and maxSurge: 0. New pods need about 90 seconds after the readiness probe passes before their latency is normal, because of JIT warm-up and empty caches.

During every midday deployment p99 latency jumps from 150 ms to 3 seconds for several minutes. Explain why, and which settings and practices fix it.
DebuggingIntermediate6 min read

A pipeline sends 1 percent of traffic to a canary for 10 minutes and promotes it automatically if its error rate and p99 latency are within 10 percent of the fleet's. A release passed and reached all regions; two hours later a large enterprise tenant reported that every invoice export failed.

Why did the canary not catch this, and how would you improve the canary process without making every release take a day?
ScenarioIntermediate6 min read

Version 42 of an order service added a status, PARTIALLY_SHIPPED, and wrote it to the database and a Kafka topic. It then showed a memory leak, so the team rolled back to version 41, which failed at once on orders with the new status, and two consumers crashed on the events.

Why did the rollback make things worse, and what rules would make releases like this safely reversible?
DesignAdvanced7 min read

A platform runs 300 services in four regions, each region split into several cells. Deployments currently reach all regions within an hour of merging, and twice this year a bad release reached every region before anyone noticed.

Design the order and pacing of deployments across environments, cells and regions so a bad change is caught while it affects a small part of the platform, and explain how emergency fixes fit in.
LeadershipPrincipal6 min read

Auditors require controlled production changes, so a weekly change advisory board approves every change by hand. Lead time has grown to two weeks, teams batch changes into large releases, and approved changes fail as often as changes did before the board existed.

As the senior technical leader, how would you replace manual approval with controls that satisfy the auditors and actually reduce change risk?

Chaos engineering and game days

Chaos engineering tests resilience by injecting real failures, such as lost instances, added latency or a cut network path, and checking that steady-state business metrics hold. Game days run such experiments as a planned team exercise. Know how to state a hypothesis, limit the blast radius, define automatic abort conditions and turn findings into fixes, and how to grow a programme safely, including in regulated organisations.

ConceptFoundations6 min read

Chaos engineering is injecting failures on purpose, such as killing instances, adding latency or cutting network paths, to learn how a system really behaves before an incident shows it. A game day is a planned session where a team runs such experiments together.

What are the steps of a well-run chaos experiment, and how does it differ from ordinary failure tests in a test suite?
CodingIntermediate7 min read

Failure behaviour can be tested before production. Toxiproxy is a TCP proxy that adds latency, cuts bandwidth or drops connections on command, and Testcontainers can run it next to a real database in an integration test.

Write a Spring Boot integration test in which PostgreSQL is reached through Toxiproxy, add 3 seconds of latency to the database connection, and assert that GET /products/42 still answers within 1 second with a cached or degraded response. What does the test need to be meaningful?
ScenarioIntermediate6 min read

Your checkout system runs in three zones of one region, and the team claims it survives a zone failure without customer impact. That has never been tested. You are asked to organise a game day in production next month.

Plan the game day: preparation, how to simulate the zone failure, what to measure, when to stop, and what happens afterwards.
ScenarioAdvanced6 min read

A team ran an approved production experiment: add 200 ms of latency to calls from checkout to the fraud-scoring service on 10 percent of checkout pods. Checkout failed for most customers for 20 minutes.

Two things went wrong: the target label selector matched every checkout pod, not 10 percent, and the abort condition, checkout errors above 5 percent for 5 minutes, was watched by hand on a dashboard that lagged by several minutes. How do you handle the aftermath, and what do you change so experiments stay safe?
LeadershipPrincipal6 min read

You lead engineering at a bank. Regulators, for example under the EU Digital Operational Resilience Act (DORA), expect evidence that critical services are tested against severe but plausible disruptions. The risk committee fears that injecting failures in production could itself cause an incident.

As the senior technical leader, how do you build a resilience testing programme that satisfies the regulator and the risk committee and actually improves resilience?

Handling traffic spikes

Spikes are rises in load far above the normal peak, from planned sales and advertisements to viral events, synchronised clients and bots. Autoscaling usually reacts in minutes, while many spikes arrive in seconds. Understand pre-scaling, headroom, caching at the edge, admission control and waiting rooms, spreading synchronised load with jitter, and telling harmful automated traffic apart from real customers before it overwhelms the backend or the budget.

ConceptFoundations6 min read

Traffic spikes are sudden rises in load well above the normal peak. Some are planned, such as a sale or a product launch; others are not, such as a viral post, a news event, a bot attack, or clients retrying after an outage.

Which techniques help a web system absorb a spike, and which of them still work when an unplanned spike arrives within seconds?
DebuggingFoundations6 min read

A smart-home platform has 3 million devices that each report their status once an hour. Average load is about 830 requests per second, yet monitoring shows over 60,000 requests per second in the first seconds of every hour, with timeouts, and the rest of the hour is quiet.

What causes this pattern, and how do you smooth it out on the device side and the server side?
ScenarioIntermediate6 min read

A consumer app's backend normally serves 2,000 requests per second. At 20:31 a TV advertisement airs and traffic reaches 40,000 requests per second within 90 seconds. Autoscaling needs about 4 minutes to add pods, the database is at 90 percent CPU, and the error rate is 35 percent.

You are on call. What do you do in the next 15 minutes, and what do you change before the next advertisement?
DesignIntermediate7 min read

A shoe brand releases a limited edition of 20,000 pairs online at 10:00, and about 1.5 million people are expected in the first minutes. The checkout backend can safely complete about 300 purchases per second.

Design a virtual waiting room that protects checkout and is fair to users: how users enter and leave the queue, how admission is controlled, and how you stop people and bots from skipping it.
ScenarioAdvanced6 min read

A retail site normally serves 5,000 requests per second. Over 20 minutes traffic grows to 75,000, almost all on product search and price endpoints, spread over hundreds of thousands of residential IP addresses. The autoscaler has grown the fleet tenfold and the search cluster is saturated.

Real customers see timeouts, and the cloud bill for the day has already tripled. How do you respond now, and what do you change so the next scraping or bot spike does not hurt customers or cost this much?