How Google Ads Was Able to Support 4.77 Billion Users With a SQL Database 🔥

Cloud Spanner is Google's globally distributed relational database that combines horizontal scalability with strong consistency. It eliminates the need for manual sharding while offering ACID transactions, high availability, and low latency across regions. Designed for mission-critical applications, it uses a synchronous replication protocol and atomic clocks for precision.
Core Technical Concepts/Technologies
- Global Distribution
- Strong Consistency (ACID)
- Synchronous Replication
- TrueTime API (atomic clocks + GPS)
- Horizontal Scaling
- Relational Schema (SQL support)
Main Points
-
Architecture:
- Data split into instances (compute) and databases (storage).
- Replication: Synchronous across zones/regions using Paxos.
- TrueTime: Ensures timestamp ordering globally, enabling consistency.
-
Performance:
- 99.999% availability (5 nines).
- Low-latency reads (local replicas) and strongly consistent writes.
- Scales horizontally by adding nodes.
-
Use Cases:
- Financial systems (e.g., AdWords).
- Global inventory management.
- Applications needing SQL + NoSQL-like scale.
-
Trade-offs:
- Higher cost than traditional SQL databases.
- Optimized for large-scale workloads; overkill for small apps.
Technical Specifications
- Replication: Minimum 3 replicas per region.
- Pricing: Based on nodes, storage, and throughput.
- SQL Dialect: ANSI-compliant with extensions.
- Schema: Supports indexes, foreign keys, and transactions.
Key Takeaways
- Consistency at Scale: Achieves ACID transactions globally without sharding.
- High Availability: Built-in redundancy with automatic failover.
- Operational Simplicity: No manual partitioning or replication management.
- Cost Consideration: Best suited for large enterprises with critical needs.
Limitations & Caveats
- Cost: Expensive for small-scale applications.
- Latency: Cross-region writes may incur higher latency.
- Learning Curve: Requires understanding distributed systems trade-offs.
- Alternatives: Consider CockroachDB or Aurora for cost-sensitive use cases.
#60: Break Into Google Spanner Architecture (5 Minutes)
This article was originally published on The System Design Newsletter
Visit Original Source