Multi Region and Multi Cloud Resilience Questions
Designing systems that work across multiple geographic regions or cloud providers. This addresses the highest reliability requirements and provides protection against provider-level failures. At senior level, understand data replication across regions, latency implications, consistency trade-offs, and cost of multi-region deployments. Design routing policies that direct traffic to healthy regions. Address compliance requirements that may mandate geographic distribution.
HardSystem Design
35 practiced
Design a multi-region, multi-cloud upgrade/migration path for a critical stateful service requiring zero data loss. Include rolling upgrade ordering, cross-region replication compatibility, feature flags, runbook steps, and automatic rollback conditions.
Sample Answer
Requirements & constraints:- Zero data loss for a critical stateful service across 3 regions and 2 cloud providers.- Live traffic must continue; latency/SLOs must be preserved.- Multi-master not allowed unless proven conflict-free. Assume primary-writer per shard/region with async/sync replication options.High-level approach:- Use leader-per-shard (primary) with synchronous cross-region replication for critical shards, async for less critical with durable WAL.- Blue/green rolling upgrade with immutable images, canary plus progressive traffic shifting via feature flags.- Maintain schema/protocol compatibility (backward + forward compatible) across versions.Rolling upgrade ordering (per shard/region):1. Canary: upgrade one replica in secondary region (non-primary) per cloud to new version, run smoke tests.2. Promote canaries to serving reads only if healthy.3. Upgrade all secondaries in region A, then failover tests with read/write routing to verify replication.4. Upgrade primary only after secondaries healthy and replication lag = 0 and catch-up verified.5. Repeat for other regions and cloud provider, staggered so at least one region runs old-primary until its replacement is verified.Cross-region replication compatibility:- Support dual-write toggle off by default. Ensure new version can speak to old via compatibility layer: accept old RPCs, produce WAL in format both can read.- Use schema-versioned WAL and feature negotiation at connection handshake.- Run pre-migration compatibility tests (synthetic traffic) to validate interop.Feature flags & traffic control:- Feature flags: - rollout.mode = {canary, progressive, full} - write.version = {v1,v2,dual} — dual writes to both versions for validation - read.version = {prefer-v2, prefer-v1}- Use service mesh / LB to route % traffic; start 1% canary → 10% → 50% → 100% per region after health checks.Runbook (operational steps):1. Pre-checks: backup snapshot, ensure retention, verify monitoring & alerts active, confirm team on-call.2. Start canary: deploy to one secondary replica in non-primary region. Wait 10–30m; check CPU, memory, error rate, replication lag, application-level sanity.3. Promote canary reads: route small percent of reads; run synthetic workloads validating correctness.4. If healthy, expand to all secondaries in region; validate WAL compatibility and lag=0.5. Upgrade primary: drain writes, confirm secondaries have caught up, switch writes to a healthy secondary, upgrade old primary, reintroduce into cluster as secondary.6. Repeat per region/cloud, maintaining at least one old-version primary until peers upgraded and verified.7. Final full traffic shift and disable dual-write/feature flags.8. Post-migration: run data integrity checks, reconcile metrics, keep increased monitoring window.Automatic rollback conditions (automated safety gates):- Immediate rollback if any of: - replication lag > threshold (e.g., 5s for sync-critical shards) for > 2 minutes - error rate increase > X% (e.g., 300% or absolute > 5% p95) - write confirmations drop below SLO - data inconsistency detected by checksum validation - CPU/memory out-of-bounds indicating OOM or thrashing- Rollback steps automated: - Stop routing traffic to new nodes; route back to old-version primaries - Trigger automated restore from latest snapshot if WAL gaps detected - Alert on-call and create incident with context - If rollback fails, escalate to manual intervention with runbook appendix.Safety & testing:- Dry-run in staging with network partitions and failover tests.- Chaos testing: simulate region failover, packet loss, and leader crashes.- Continuous data verification: checksums, end-to-end transaction IDs, read-after-write tests.Observability & automation:- Metrics: replication lag, commit latency, tail latency, error rate, WAL offsets.- Alerts with auto-playbooks that can execute rollback commands.- Use IaC and CI/CD pipelines with gated promotion (only after automated integration tests and compatibility checks).Trade-offs:- Synchronous cross-region replication ensures zero data loss but increases write latency—use selectively only for critical shards.- Dual-write increases verification safety but complexity; remove after full validation.This plan minimizes risk by upgrading non-primaries first, keeping strict compatibility, using feature flags for progressive traffic shift, and automating rollback on strong safety signals.
MediumTechnical
35 practiced
How would you design a realistic multi-region failover testing strategy in staging that avoids impacting production but still gives confidence that failover mechanisms work? Describe test types, how to simulate partial failures, validation checks, and guardrails to prevent accidental production impact.
Sample Answer
Requirements & goals:- Verify multi-region failover works end-to-end without touching production.- Exercise control-plane, data replication, DNS/routing, and client behavior.- Provide measurable success criteria (RPO/RTO targets, traffic shift metrics) and safe guardrails.Test design (types):1. Unit / component tests: simulate region outage at service/process level in CI (e.g., kill service, blackhole network).2. Integration tests in staging: full-stack failover rehearsals that run on a staging environment mirroring prod topology (regions, load balancers, DNS, DB replicas).3. Chaos experiments: targeted partial-failure scenarios (network partition, region-level API blackhole, instance depletion) using Chaos Toolkit/Chaos Mesh/Gremlin in staging.4. End-to-end “canary cutover” rehearsals: shift a small percentage of synthetic traffic across regions to validate routing, latency, and data integrity.How to simulate partial failures:- Network-level: apply iptables rules or service-mesh tx drop to emulate packet loss/latency for a region.- Control-plane: disable autoscaling groups or mark AZ/region as unhealthy in staging’s cloud provider APIs.- Data-layer: pause replica apply or introduce replication lag via throttling.- External dependencies: mock or inject failures for third-party APIs.Validation checks (automated):- Health: service and instance health, readiness/liveness probes.- Traffic: metrics on routing (percentage routed), error rates, latency P50/P95, and successful request rate.- Data integrity: consistency checks, schema/version compatibility, end-to-end transactional verification for synthetic writes.- Recovery: measured RTO (time to restore client traffic) and RPO (data loss window).- Alerts: ensure paging/alerts fire correctly and incident playbooks trigger.Guardrails to avoid production impact:- Isolated staging: duplicate VPC/accounts with identical infra-as-code. Never run chaos scripts against prod accounts.- Resource tagging & RBAC: restrict chaos tooling permissions; require 2-person approval for any destructive test.- Read-only mode tokens: use synthetic traffic and test credentials; forbid use of prod datasets—use anonymized snapshots.- Rate limits & blast radius controls: limit percentage of traffic, instance counts, or time windows; start with minimal scope and escalate.- Automated safety checks: preflight checks verify environment, no active deploys, error budgets, and monitoring readiness before test starts.- Cancellation & rollback hooks: abort on threshold breaches (error rate, latency) and automated remediation (re-enable routes, scale up).- Post-test review: runbook-driven postmortem and update tests/playbooks.Example cadence:- Weekly automated small-scope chaos (network latency to one AZ) in staging.- Monthly full-region failover rehearsal in staging with SRE and on-call rotation practicing runbooks.- Quarterly cross-team dry-run with stakeholders and verification metrics reported to SLO owners.This approach balances realism (full-stack, multi-region scenarios) with safety (isolated staging, RBAC, canary blast limits, automated aborts) and produces measurable confidence in failover readiness.
EasyTechnical
35 practiced
Explain options for replicating object and block storage across regions. Compare cloud-managed cross-region replication (e.g., S3 CRR) to application-level replication and to block-device replication. Discuss consistency guarantees, egress cost implications, and common operational pitfalls.
Sample Answer
High-level options for cross-region replication:- Cloud-managed object replication (e.g., S3 CRR / AWS Replication)- Application-level replication (app copies objects between regions)- Block-device replication (DRBD, cloud block snapshots/replication)Comparison (consistency / semantics):- Cloud-managed object replication: usually eventual consistency across regions; objects appear atomically in target per-object (object PUTs are replicated asynchronously but providers guarantee FIFO for versioned buckets or configurable options). Read-after-write in source is immediate; read-after-write in replica can lag.- Application-level replication: consistency depends on your logic (can be synchronous for strong consistency at latency cost, or async/eventual using queues). Gives fine-grained control (conflict resolution, partial writes).- Block-device replication: typically provides near-synchronous replication for whole volumes (sync/async modes). Sync gives strong consistency but high latency and limited WAN practicality; async reduces latency but risks data loss of recent writes.Egress cost implications:- Cloud-managed CRR: provider often charges inter-region replication egress and additional storage; some providers include replication in pricing tiers—check exact billing.- App-level: you pay standard egress for transfers plus possibly message/queue costs; inefficient bulk transfers can increase costs if you re-transfer unchanged objects.- Block-device: replicating block streams across regions can be expensive due to continuous data transfer and snapshot storage charges.Common operational pitfalls:- Hidden costs: metadata, PUT requests, lifecycle transitions, and cross-region GETs can add up.- Incomplete consistency model understanding: assuming zero RPO for async modes; after failover, clients may observe missing objects.- Performance impact: synchronous block replication increases latency; app replication must handle backpressure and retries.- Metadata and ACL drift: ensure IAM, object metadata, and encryption keys are replicated or accessible.- Large-scale re-syncs: failover testing or recovery can trigger massive egress; plan bandwidth and throttling.- Monitoring: lack of replication metrics (lag, error rates) causes blindspots—add alerts and periodic end-to-end validation.Recommendation for SREs: prefer cloud-managed CRR for simple object-level DR with lower ops overhead; use app-level when you need custom conflict resolution or transactional semantics; choose block replication only when you require volume-consistent snapshots and can accept latency/cost trade-offs. Always measure lag, budget egress, and run failover drills.
MediumSystem Design
35 practiced
Outline a CI/CD strategy for rolling out application changes across multiple regions and clouds. Include canary and phased rollouts, regional dependency coordination, automated rollback triggers tied to SLO burn, and how to orchestrate database schema changes that span regions.
Sample Answer
Requirements:- Zero/low downtime cross-region; consistent config across multi-cloud providers; automated canary + phased rollouts; rollback when SLO burn threshold exceeded; coordinated multi-region DB schema migrations with safety.High-level architecture:- CI: pipeline (Git + CI runner) builds container images, runs tests, publishes immutable artifacts to registry and multi-region artifact store.- CD: central orchestration service (ArgoCD/Spinnaker) triggers deployments per-region/cloud, integrating with Kubernetes clusters / VM autoscaling groups.- Observability: centralized metrics (Prometheus/Thanos, Cortex), distributed tracing (Jaeger), logs (ELK/Datadog).- Feature control: LaunchDarkly or homegrown feature flags + traffic shaping.Rollout strategy:1. Canary: deploy to small percentage of traffic in one region (or one AZ) using weighted routing (Istio/ALB) for 5–10% traffic. Run synthetic and real-user AB tests and golden signals (latency, error rate, saturation).2. Phased rollout: expand across instances/regions in phases (10% → 25% → 50% → 100%) with pause windows and automated validation gates.Regional dependency coordination:- Dependency graph storing service-region dependencies (e.g., cache primaries, read replicas, regional auth).- Orchestrator enforces ordering: update stateless services first, then regional stateful services, then cross-region shared services.- Use region-aware traffic policies: steer traffic away from regions in transition.Automated rollback tied to SLO burn:- Define SLOs and burn-rate policies (e.g., if 5-minute burn rate > X% or error rate exceeds threshold, trigger rollback).- Deploy monitors that evaluate golden signals and calculate burn in real time (Prometheus alertmanager with burn-rate rules).- CD system subscribes to alerts: on trigger, automatically initiate rollback to previous artifact and mark rollout as failed; notify on-call and open incident.Database schema orchestration across regions:- Prefer backward-compatible, incremental migrations using a three-phase approach: 1. Expand: deploy additive changes (new columns/tables, defaults nullable) and update services to write both old and new schema. 2. Dual-read/write: traffic uses feature-flag to switch reads to new schema gradually; verify data correctness with consistency checks. 3. Contract: once verified, remove old fields and finalize schema.- Use a migration coordinator (Flyway/gh-ost/pt-online-schema-change) with leader election per region to run shards safely; use change-data-capture (Debezium) to replicate and validate across regions.- For strong schema changes requiring coordination (PK changes), use blue-green db pattern on a single-master followed by controlled cutover during low traffic window with enforced read-only fallback and rollback scripts.Operational practices and trade-offs:- Canary + SLO automation minimizes human latency but requires robust monitoring and alert tuning (false positives risk).- Multi-cloud increases resilience but complicates networking/consistent storage—prefer eventual consistency where possible.- Invest in rehearsals: chaos testing, runbooks, and "resume" playbooks for failed rollouts.This strategy balances safety (canaries, SLO-triggered rollback), speed (automated phased rollout), and correctness (backward-compatible DB migrations and dependency-aware orchestration).
HardSystem Design
49 practiced
Design a global service discovery mechanism for ephemeral Kubernetes workloads running in clusters across multiple clouds and regions. Consider how services find each other, handle latency, deal with stale entries, and maintain security (authentication and authorization) across cluster boundaries.
Sample Answer
Requirements:- Global discovery for ephemeral K8s workloads across clouds/regions- Low-latency lookups, eventual consistency, bounded staleness- Handle churn (pod/service autoscaling, short-lived jobs)- Secure cross-cluster authZ/authN, auditability- High availability and measurable SLOsHigh-level architecture:- Local sidecar-based agent (per node/namespace) + region control plane + global control plane- Service registration: workloads register service records to local agent via mTLS. Agent batches and pushes to region control plane (gRPC).- Region control plane maintains authoritative short‑lived leases (TTL-based) and publishes change events to global control plane (Kafka or pub/sub).- Global control plane provides read-optimized stores (geo-replicated, e.g., CockroachDB or DynamoDB + CDN/cache) and a global API/edge DNS layer for clients.Key components & responsibilities:1. Local Agent: watch K8s Endpoints/Endpointslices, perform health checks, enforce rate limits, sign registrations, issue ephemeral lease tokens.2. Region Control Plane: validate tokens, deduplicate, maintain region registry, produce events, enforce policies (quota, routing).3. Global Control Plane: aggregate regions, serve global queries, compute locality-aware answers (prefer same region, fall back), maintain TTL and vector clock / version to bound staleness.4. Cache/Edge: client-side library that caches entries with lease expiry and uses soft-state refresh; fallback to region endpoints on cache miss.5. Security: mTLS between components, JWT short-lived tokens issued by central OIDC (or SPIFFE/SPIRE) for workload identity. RBAC enforced at control planes; authZ policies evaluated in-region and globally.6. Observability: metrics (registration rate, TTL expirations, lookup latency), distributed tracing, alerts for divergence, and audit logs for auth decisions.Data flow:- Pod -> registers with local agent -> agent issues signed lease -> region CP validates and stores TTL-record -> event to global CP -> global index updated -> clients query global CP or local cache.Handling latency & staleness:- Prefer local/region answers using locality-aware routing to minimize cross-region latency.- Use short TTLs (e.g., 10–30s) and lease refreshes; clients perform optimistic caching with validity based on TTL and health probes.- Resolve churn by batching updates and debouncing flaps; employ "grace period" where a recently removed entry remains for X seconds marked as "possibly stale" with health-score.Dealing with stale entries:- Leases expire automatically; control planes garbage-collect on TTL expiry.- Heartbeat + sequence numbers; control planes reconcile by comparing region snapshots (anti-entropy).- Clients prefer healthy endpoints (health-checked). On connection failures, clients re-resolve and backoff.Security (authN/authZ & multi-cluster trust):- Use SPIFFE identities issued by SPIRE per workload; mTLS for all control channel comms.- Centralized policy store (OPA/Gatekeeper) replicated; evaluation at region CP and client-side for fine-grained RBAC.- Short-lived tokens for cross-cluster requests; signed assertions include audience, TTL, region, service labels.- Mutual attestation for new clusters (trust bootstrap via signed CSR + human approval or automated CA workflow).Scalability & HA:- Agents are stateless; region CP is sharded by namespace/service hash; global CP is read-optimized with geo-replication.- Use pub/sub (Kafka/CloudPubSub) for change events; replicate event streams per region.- Backpressure: agents batch and rate-limit registrations; use circuit breakers in clients.Trade-offs:- Strong consistency would add latency; we choose eventual consistency with bounded staleness for availability.- Short TTLs increase control plane load — mitigate via batching, edge caching, and health-based filtering.- Centralized policy simplifies governance but increases blast radius; mitigate with region-level policy caches and fail-open/closed rules per service SLA.SLOs & operational practices:- SLOs: 99.95% successful discovery within 200ms for same-region; 99.9% TTL expiry cleanup within 2x TTL.- Alerts: spikes in stale entries, reconciliation lags, authentication failures.- Runbook: rollbacks, partition handling, cluster bootstrap, and key rotation.This design provides low-latency, secure, and scalable global service discovery while bounding staleness through leases, locality-aware routing, and robust security via SPIFFE/SPIRE and short-lived tokens.
Unlock Full Question Bank
Get access to hundreds of Multi Region and Multi Cloud Resilience interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.