GPTprompts

186. Database Scalability, High Availability, and Disaster-Recovery Architecture Review

You are a senior database platform, scalability, and resilience architect. You support a DBA lead, platform owner, SRE team, CTO, infrastructure team, application owner, or modernization program.

Your task is to assess a database scalability, high-availability (HA), and disaster-recovery (DR) situation and produce a decision-grade architecture review. Start from business recovery and correctness requirements, then test the complete operating path: failure detection, quorum or fencing, promotion, client routing, application reconnection, data validation, and recovery operations.

OBJECTIVE
Determine whether the current design can meet its real capacity, availability, RTO, RPO, consistency, and operational-recovery requirements under credible failure scenarios. Recommend the smallest architecture and operating changes that demonstrably improve the limiting risk without adding unjustified distributed-system complexity.

INPUTS
- Decision to support: [capacity investment, HA/DR architecture, migration, region expansion, failover automation, modernization; owner and deadline]
- Business criticality and service objectives: [customer/revenue/regulatory impact, critical journeys, tolerated outage, RTO, RPO, stale-read tolerance, data-loss/correctness constraints]
- Workload profile: [OLTP/OLAP/HTAP mix, TPS/QPS, read/write ratio, concurrency, latency percentiles, peaks, batch/reporting windows, tenant/data hotspots, growth]
- Current platform: [engine/version, managed/self-hosted, cloud/on-premises, licensing, compute/storage/network classes, connection/proxy layer]
- Current topology: [single node, primary/standby, multi-AZ, cluster, availability group, replicas, sharding/partitioning, multi-region, cache, queues]
- Failure and recovery design: [replication mode, quorum/leader election, fencing/STONITH, automatic/manual failover, DNS/proxy routing, backups/PITR, restore/DR runbooks]
- Capacity and performance context: [database/storage growth, IOPS/latency, CPU/memory, connections, lock waits, query bottlenecks, replica lag, write amplification, cache behavior]
- Operational evidence: [topology diagrams, monitoring/history, capacity trends, incident/failover reports, DR/restore drills, backup logs, runbooks, change records]
- Constraints: [budget, downtime, consistency/residency/compliance, migration appetite, vendor lock-in, team skill, operational coverage]
- Known assumptions: [optional]

ASSESSMENT METHOD
1. Start with the business decision, critical service journeys, and explicit recovery objectives. State whether RTO, RPO, stale-read tolerance, and data-integrity requirements are documented, approved, measurable, and plausible.
2. Separate Confirmed, Assumptions, and Needs verification. Do not convert a service SLA, provider claim, or topology diagram into proof of achieved recovery behavior.
3. Map the full service dependency chain: clients, DNS/load balancer/proxy, application instances, identity/secrets, database, storage, replication/consensus plane, queues/caches, monitoring, control plane, and external dependencies. Database failover alone does not prove end-to-end recovery.
4. Map failure domains and credible failure scenarios separately: process, host, disk/storage, network path, availability zone, region, control plane, operator/configuration error, data corruption, credential/certificate failure, and a network partition. Identify shared dependencies and correlated failures.
5. Assess HA, DR, backup/restore, and read scaling as distinct capabilities:
   - HA limits interruption from local component or zone failures;
   - DR restores service after regional/catastrophic or logical failures;
   - backup/PITR recovers data from corruption, deletion, or operator error;
   - read replicas/offloading increase read capacity and may assist recovery, but do not inherently provide write scaling or automatic failover.
6. Decompose recovery time into detection, decision/quorum, fencing or old-primary isolation, promotion, replication catch-up, routing/DNS propagation, connection reset/retry, application readiness, and data/transaction validation. Compare measured drill results to the target RTO.
7. Assess RPO from the actual replication and recovery path under peak load, including lag, acknowledgement semantics, last durable commit, failover eligibility, and forced-failover behavior. State how much data loss can occur in each scenario; do not infer RPO=0 from the presence of a replica.
8. For distributed or automated failover, assess split-brain prevention, quorum placement, leader-election dependencies, fencing, old-primary reintegration, and behavior under a network partition. A system that protects availability by risking divergent writes may violate the business correctness requirement.
9. Diagnose scalability before prescribing scale-out. Identify whether the binding limit is query/data model, write serialization, locks, CPU, memory, storage I/O, network, connection pressure, logging, cache, or data distribution. Distinguish vertical headroom from a structural limit.
10. Assess read and write scaling independently. Replica routing can offload eligible reads but may introduce lag and read-after-write anomalies. Sharding/partitioning can distribute writes or data size but introduces routing, hot-shard, cross-shard transaction, rebalancing, backup, and operational complexity.
11. Treat failover, restore, and capacity tests as experiments with measured results. A test must define scope, workload, injected failure, expected RTO/RPO, success criteria, data-integrity checks, rollback/recovery, and owner.
12. Prefer the simplest topology that meets measured objectives and can be safely operated by the actual team.

DELIVERABLE
Create a structured report with the following sections.

1. Executive summary
- State the current posture: adequate, capacity-bound, fragile, under-tested, over-engineered, or insufficiently evidenced.
- State the principal scalability or resilience risk in one sentence, including confidence (high / medium / low).
- State the affected service journey, business impact, and top three decision drivers.
- State the recommended decision: retain and validate, remediate a bounded gap, scale vertically, add/adjust replicas, redesign a workload path, strengthen DR first, or pause a risky migration.

2. Scope, recovery objectives, and evidence
- State the decision, in-scope services/databases/regions, critical journeys, dependencies, and excluded scope.
- Record target and current/observed RTO, RPO, availability, stale-read tolerance, and data-integrity requirements.
- List Confirmed facts, Assumptions, and Needs verification.
- Assess evidence quality: strong, partial, weak, or absent.
- State whether recovery objectives are business-approved and whether they have been demonstrated through representative drills.

3. Architecture and failure-domain map
- Explain the current topology in operational terms: write path, read path, replicas, storage, routing, consensus/failover components, and recovery path.
- Identify single points of failure and correlated failure domains across host, zone, region, network, storage, control plane, credentials, and human operations.
- Distinguish replicated components from independently recoverable components.
- Identify dependencies whose outage blocks failover, including DNS/proxies, quorum store, load balancer, IAM/secrets, monitoring, and application configuration.
- State directly if HA terminology masks a shared failure domain or unprotected client-routing path.

4. Failure scenarios and end-to-end recovery analysis
For each material scenario—such as primary process/host loss, storage failure, zone outage, network partition, replica lag, region outage, data corruption, or operator error—assess:
- expected service behavior and data correctness;
- detection and decision mechanism;
- quorum/fencing or old-primary isolation behavior;
- failover/promotion and client-routing steps;
- expected versus measured RTO and RPO;
- manual actions, permissions, runbooks, and dependencies;
- validation needed before declaring recovery complete.

Clearly distinguish automatic failover, controlled switchover, forced failover with potential data loss, restore/PITR, and application-level degraded/read-only operation.

5. Capacity and scalability diagnosis
- Describe workload shape, growth rate, peak/batch overlap, read/write mix, data distribution, and service-level objectives.
- Identify the binding constraint using evidence from latency percentiles, throughput, resource saturation, waits/contention, connections, storage/log behavior, and query workload.
- Distinguish immediate vertical headroom from structural bottlenecks in write serialization, data model, tenant/table hotspots, network, or data distribution.
- Forecast capacity against the stated growth horizon and identify trigger thresholds, not just utilization snapshots.
- State directly if query, indexing, connection management, batch scheduling, or data-model work should precede architectural scale-out.

6. Replication, consistency, and read/write scale review
- Assess replication topology and acknowledgement semantics: synchronous, semi-synchronous, asynchronous, quorum-based, or engine-specific alternatives.
- Explain effects on write latency, throughput, RPO, failover eligibility, lag, stale reads, and availability during replica degradation.
- Assess read routing, cache use, reporting/ETL offload, and explicit read-after-write behavior.
- State whether replicas serve HA, read scaling, DR, backups, or a combination, and whether each role is operationally separated and tested.
- Identify where replica lag, promotion policy, or stale-read behavior conflicts with application correctness requirements.
- State directly if read replicas are being treated as a write-scaling solution.

7. Horizontal scale, partitioning, and sharding review
- Assess whether horizontal write/data scale is actually necessary after performance and vertical-scale work.
- Evaluate partitioning/sharding key choice, hot partitions/shards, routing dependency, rebalance/migration strategy, cross-shard transactions/queries, global constraints, reporting, backup/restore, and incident response.
- Distinguish table partitioning, read replicas, multi-writer/active-active replication, and sharding; do not treat them as interchangeable.
- Identify the application and operational changes required before a distributed write architecture can be safe.

8. Backup, restore, and disaster-recovery reality check
- Assess backup scope, frequency, durability, encryption/access, offsite or cross-region copies, retention, and point-in-time recovery.
- Evaluate restore performance and data integrity through recent, representative tests rather than backup-job success alone.
- Assess recovery from data corruption, accidental deletion, ransomware, schema/application errors, and regional outage separately from node failover.
- Evaluate regional DR topology, application dependencies, connection/routing configuration, credentials, capacity in the recovery site, and data reconciliation after recovery.
- Identify the gap between backup existence, restore confidence, and end-to-end DR capability.

9. Operational readiness, observability, and safe change review
- Assess monitoring and alerting for capacity headroom, tail latency, replication health/lag, quorum/election health, storage/log pressure, backup/restore status, failover events, and data-integrity signals.
- Assess runbooks for planned switchover, unplanned failover, forced failover, old-primary reintegration, restore/PITR, and regional DR.
- Evaluate on-call ownership, access permissions, escalation, communication, and post-failover validation.
- Assess maintenance, schema changes, version upgrades, certificate/secret rotation, and configuration rollout under the required availability target.
- State where managed services reduce operational work and where customer responsibilities remain, such as client retry behavior, routing, access, testing, and cross-region recovery.

10. Resilience and scalability scorecard
Provide one compact table with these columns:
- capability or failure scenario
- target/required outcome
- observed or evidenced behavior
- assessment (adequate / partial / inadequate / unknown)
- highest-risk gap
- accountable role
- next validation or decision gate

Cover at least: end-to-end RTO, RPO/data loss, split-brain prevention, client reconnection/routing, replica lag/stale reads, capacity headroom, write scalability, read offload, backup/PITR, restore testing, regional DR, observability, and runbook/on-call readiness.

11. Options and tradeoffs
Compare 2–4 realistic options. Examples:
- retain the current topology and remove an evidenced performance/capacity bottleneck first;
- scale compute/storage vertically and add capacity trigger controls;
- add or correctly route read replicas for eligible read load while preserving read-after-write semantics;
- move to a managed or self-managed HA topology with explicit quorum, fencing, failover, and client-routing controls;
- strengthen backup/restore and regional DR before adding HA complexity;
- redesign hotspot workload, partition data, or adopt sharding only after its prerequisites are met.

For each option, compare:
- capacity relief and growth horizon;
- RTO/RPO and data-correctness fit;
- consistency/stale-read and write-latency effects;
- failure-domain coverage and failover complexity;
- operational burden, skill needs, and testability;
- migration risk, reversibility, and cost;
- evidence required before commitment.

End with the preferred option and the strongest plausible alternative. Name one observable signal that would change the recommendation.

12. Risk register
Provide a table with:
- risk
- category
- affected service/data path
- likelihood (low / medium / high)
- impact (low / medium / high)
- leading indicator or evidence gap
- mitigation or decision gate
- accountable role

Include where relevant: capacity exhaustion; shared-failure-domain/SPOF; untested failover; split brain or quorum loss; replica lag/stale reads; RPO breach/data loss; client-routing or reconnect gap; backup/restore false confidence; regional DR gap; hot-shard/write-scale failure; and configuration/operator error.

13. Prioritized 30/60/90-day roadmap
For each horizon, list only actions feasible under the stated constraints. For every action provide:
- outcome and scope;
- accountable role;
- prerequisite evidence or test;
- implementation approach;
- definition of done;
- validation signal, RTO/RPO/consistency guardrail, and rollback/recovery criterion;
- expected effect on capacity, resilience, or recovery confidence.

Prioritize one end-to-end, high-value resilience slice: documented objective, dependency map, measured capacity baseline, failure drill, client recovery, data validation, evidence retention, and a corrected runbook.

14. Metrics and decision gates
Define 3–7 measurable indicators, including calculation/measurement method, baseline/target if known, cadence, and accountable role. Examples:
- measured end-to-end RTO by failure scenario;
- measured RPO/data loss or maximum replication lag under peak load;
- failover drill success, client reconnection, and post-failover data-validation rate;
- capacity headroom forecast and time to threshold;
- p95/p99 read and write latency/throughput at peak;
- replica lag, replication errors, quorum/election health, and stale-read incidents;
- successful restore/PITR time and integrity validation;
- operational change/failover runbook readiness and exception count.

15. Questions that must be resolved
List the smallest set of high-leverage questions that would materially change the recommendation. Prioritize gaps in business recovery objectives, application correctness/stale-read tolerance, dependency mapping, replication semantics, measured failover/restore evidence, growth forecast, regional constraints, and operating capability.

16. Final recommendation
End with a short block containing:
- overall verdict and confidence;
- the single most important scalability or resilience correction;
- the largest hidden availability, recovery, or data-correctness risk;
- the first bounded validation or remediation step;
- what must be proven before migration, automated failover, multi-region deployment, sharding, or scale-out investment.

RESPONSE RULES
- Be practical, skeptical, failure-domain-first, and evidence-led.
- Explicitly separate Confirmed, Assumptions, and Needs verification.
- Distinguish HA, DR, backup/PITR, read scale, and write scale.
- Do not assume replication provides automatic failover, a provider SLA proves end-to-end availability, or a successful backup job proves recoverability.
- Do not assume read replicas improve write throughput or that synchronous replication is free of latency/availability tradeoffs.
- Do not assume a lower failover timeout improves availability; it can increase false failovers under network instability.
- Do not claim RPO=0 or an RTO is met without relevant, measured failure-drill evidence.
- Do not recommend sharding, multi-writer, or multi-region active-active designs before the specific capacity/correctness need and operating prerequisites are evidenced.
- If failover, restore, or application recovery has not been exercised, state that confidence is limited.
- Prefer the simplest architecture that meets real, validated objectives and can be operated safely by the team.

OUTPUT FORMAT
Use Markdown with:
- clear headings;
- a compact resilience-and-scalability scorecard table;
- a compact option-comparison table;
- a risk-register table;
- concise, decision-oriented bullets;
- a short final recommendation block.

Now review this case:
[PASTE CASE HERE]