Programming
We provide developers and engineers the guides and tutorials they...
Search
We provide developers and engineers the guides and tutorials they...
Content is king. It's not just about how you're going to write, b...
Looking for an engaging connection with thousands of other people...
Why Google, Amazon and Meta built Bigtable, Dynamo, Spanner and Cassandra: the limits of existing databases, and why not to copy them.
Quick answer: The largest technology companies built their own databases because, at the time, nothing they could buy survived their workload. General-purpose databases of the early 2000s were designed to run on one powerful machine. Companies such as Google and Amazon needed to spread data across thousands of ordinary machines, stay available while some of those machines were failing, and do it at a cost that licences per server made impossible. So they wrote systems tuned to their own access patterns and trade-offs. Their published designs became the basis of most modern distributed databases, which is the main reason almost nobody else needs to build one today.
Also Read: Why Do Computers Need Both RAM and Storage? - How To's
A traditional relational database grows by scaling up: a bigger server, more memory, faster disks. That works until the largest available machine is not big enough, and long before then it becomes very expensive.
The alternative is scaling out across many machines. In the early 2000s the mainstream databases did not do this by themselves. Teams split the data by hand, a technique called sharding, and built their own tooling to route queries, move data and recover from failures. At a certain size that tooling is a database, written badly and by accident.
Other pressures pushed in the same direction:
Google needed to store the web index and data for products such as Maps and Earth. The Bigtable paper describes a "sparse, distributed, persistent multidimensional sorted map" designed for petabytes across thousands of commodity servers. Its storage design, based on sorted, immutable files that are merged in the background, made the LSM tree popular. See B-trees vs LSM trees.
Open-source descendants: HBase, and part of Cassandra's design.
Amazon's shopping basket had to accept writes always, even during failures, because a rejected "add to basket" is lost revenue. The Dynamo paper describes a key-value store that chooses availability over strict consistency. It combined consistent hashing, replication with tunable quorums, version tracking and a gossip protocol, and accepted eventual consistency as the price.
The paper's Dynamo is an internal system. The cloud service DynamoDB is a later, different product that took its name and some of its ideas.
Open-source descendants: Cassandra, Riak, Voldemort.
Built at Facebook for inbox search and then open-sourced, Cassandra combined Dynamo's distribution model with Bigtable's data model. It is now an Apache project used widely outside the company that created it.
The first wave gave up transactions and SQL to gain scale, and application developers paid for it in complexity. Spanner was Google's answer: a database that is distributed across the globe and offers strongly consistent transactions and SQL. The Spanner paper describes how it uses TrueTime, an API backed by GPS receivers and atomic clocks that reports time with a known bound of uncertainty, to order transactions across data centres. See clocks in distributed systems.
Systems inspired by it: CockroachDB, YugabyteDB, TiDB.
| System | Built by | Built for | Key choice |
|---|---|---|---|
| Bigtable | Huge, sparse tables | Scale and throughput; LSM storage | |
| Dynamo | Amazon | Always-writable key-value data | Availability over consistency |
| Cassandra | Write-heavy data across many nodes | Dynamo's distribution, Bigtable's model | |
| Spanner | Global data needing transactions | Strong consistency using synchronised clocks |
Many other companies did the same in their own niches: stores for social graphs, time-series metrics, analytics and logs.
A general-purpose database must be acceptable at everything. A purpose-built one can be excellent at one thing. The CAP theorem says a distributed system must choose how to behave when the network splits; Dynamo and Spanner made opposite choices, each correct for its workload.
Also Read: Why Is Naming Things So Hard in Programming?
If every query is "fetch this key" or "scan this range", you can drop joins, the query planner and much else, and gain speed and simplicity.
For a company running hundreds of thousands of servers, a few percent of efficiency is worth more than the salaries of the team that finds it. The same sum is a rounding error for a small company.
Owning the system means being able to diagnose and fix any problem, integrate with internal infrastructure, and avoid dependence on a vendor's priorities.
These companies could hire and retain large teams of distributed systems specialists, and keep them on the problem for a decade.
Building a database is among the hardest tasks in software.
Even the giants do not do it casually. They run plenty of MySQL and PostgreSQL as well, often with heavy sharding layers on top.
The conditions that justified those systems no longer apply to most organisations.
A sensible order of escalation:
Very few organisations reach step 6. For the choice between existing families, see SQL vs NoSQL.
The most valuable output of this work was not the software but the papers. By publishing their designs, these companies taught the industry how to build distributed storage. An entire generation of open-source databases followed, and the cloud providers turned the same ideas into managed services anyone can rent by the hour.
To store and serve very large structured datasets, such as its web index, across thousands of commodity machines, which existing databases could not do.
No. Dynamo is the internal system described in Amazon's 2007 paper. DynamoDB is a later managed cloud service that shares the name and some concepts.
Almost never. Existing open-source and managed databases cover nearly every need, and building one is a multi-year effort with a high risk of data loss.
Yes, widely, often alongside their custom systems and with additional layers for sharding.
Big tech companies built databases because their scale arrived before the tools did. Each system was a specific answer to a specific workload, with deliberate trade-offs. Their lasting contribution is that the answers were published and reimplemented, so the rest of us can choose a database instead of writing one.