High Availability and Disaster Recovery
Docs: Disaster recovery planning guide
| Term | Definition |
|---|
| RTO (Recovery Time Objective) | Maximum acceptable downtime β how long until the service must be restored |
| RPO (Recovery Point Objective) | Maximum acceptable data loss β how far back in time can you afford to lose data |
| SLA | Contractual uptime commitment made to customers |
| Availability | Expressed as a percentage; each additional "9" is 10Γ harder to achieve |
| Availability | Max downtime/year |
|---|
| 99% | ~87 hours |
| 99.9% | ~8.7 hours |
| 99.99% | ~52 minutes |
| 99.999% | ~5 minutes |
- Multi-zone β deploy across 2β3 zones within the same region. Protects against single zone failure. Lower latency and cost.
- Multi-region β deploy across 2+ regions. Protects against full regional outage. Higher cost and latency.
Most applications need multi-zone for HA. Multi-region is required only when a regional GCP outage would breach SLA or compliance requirements.
| Pattern | Description | RTO | RPO | Cost |
|---|
| Cold standby | Backup data exists; resources are not running. Restore from scratch on failure. | Hours | Hours | Lowest |
| Warm standby | Scaled-down replica running in a secondary region; promoted on failure. | Minutes | Minutes | Medium |
| Hot standby | Full-scale replica actively serving traffic; failover is instantaneous. | Seconds | Near-zero | Highest |
Choose cold when budget is the priority and RTO hours are acceptable. Choose hot only when the business requires near-zero downtime and cost is secondary.
| Service | HA Mechanism |
|---|
| Compute Engine | Regional MIG β spread instances across zones; autohealing replaces failed VMs |
| Cloud SQL | HA configuration β standby instance in a second zone; automatic failover in ~60s |
| Cloud Spanner | Multi-region config β synchronously replicated across regions; 99.999% SLA |
| Cloud Storage | Multi-region or dual-region buckets β data replicated across geographic locations |
| GKE | Regional cluster β control plane and nodes span 3 zones; nodes replaced automatically |
| Cloud Run | Global; automatically distributed across zones within a region |
| Pub/Sub | Fully managed; globally replicated by default |
| BigQuery | Geo-redundant by default within a multi-region location |
- Load balancer health checks β LB removes unhealthy backends from the pool automatically
- MIG autohealing health checks β recreates VMs that fail the health check
- Cloud SQL failover β promoted automatically when primary fails; clients reconnect via the same connection string
Use routing policies on Cloud DNS to implement failover:
- Failover policy β primary/secondary records; secondary only active when primary health check fails
- Weighted round-robin β distribute traffic across multiple endpoints with configurable weights
Docs: Cloud DNS routing policies
- RTO = time to recover; RPO = data loss tolerance. Low RTO β warm/hot standby. Low RPO β synchronous replication (Spanner) or frequent snapshots.
- "99.99% SLA" across regions β Cloud Spanner multi-region or Cloud Storage multi-region; not Cloud SQL single-region (only 99.95%)
- Warm standby is the most common exam answer β balances cost with acceptable RTO/RPO
- Never use cold standby when RPO = zero; it always involves data loss