Dynamo: Amazon's Highly Available Key-value Store
A store that always accepts a write, and hands the resulting disagreement back to the application to sort out.
Read the original ↗Dynamo is the paper people cite when they want to sound like they have made peace with eventual consistency. It is worth reading for the opposite reason: it is unusually honest about the bill, and it names who pays it.
The problem it was solving
The plain version: this is a store for things you look up by one key, like a shopping cart by customer id, built on the rule that it must always accept a write even when some of the machines holding that key are unreachable. To manage that, it keeps several copies of every item, lets a write succeed as soon as enough copies have acknowledged it rather than all of them, and accepts the consequence, which is that two copies can end up holding different answers. It then refuses to guess which one is right. It hands both back to the program that asked, along with enough bookkeeping to tell whether one is simply a newer version of the other or whether they genuinely diverged. Why it matters to a builder now: almost every argument you will have about eventual consistency is really this argument, and the paper is the place where the price is written down explicitly instead of being described as a scalability benefit.
Amazon's storefront is assembled from hundreds of services, and one page view touches a lot of them. The paper's framing is that at that fan-out, any component that is occasionally unavailable is continuously unavailable in practice, enough page views touch enough services that somebody is always inside the bad case. So the target is not a good average. The paper writes its service targets at the 99.9th percentile, and says plainly that this is a business choice about which customer experience matters, not a technical one.
The second constraint is the interesting one: some operations must never be rejected. The paper's example is adding an item to a shopping cart. A cart that refuses a write because a replica is unreachable has turned an infrastructure problem into a lost sale. That single requirement, always writeable, is what forces every other decision in the paper.
The scope is narrow in a second way that is almost never quoted. Dynamo runs inside one company's data centres, on machines it trusts: the paper states that it assumes a non-hostile environment, with no authentication or authorisation between nodes and no tolerance of Byzantine failure. Every design here is cheaper than a version that had to survive a malicious peer, and every later system that borrowed the architecture inherited that assumption whether or not its deployment matched.
And the workload is narrow on purpose. Dynamo is a key-value store: primary-key access only, small objects, no relational queries, no cross-key transactions. Many services at Amazon only ever needed that, and were paying for a relational database's guarantees without using them.
It is worth quoting the target in the form the paper writes it, because the form is the contribution. Section 2.2 gives a service level agreement as a bound, a percentile and a load together: respond within 300 milliseconds for 99.9 percent of requests at a peak load of 500 requests per second. Not an average, and not a percentile without a load attached, because a latency figure measured at an arbitrary traffic level says nothing. The paper then explains the choice of the 99.9th percentile rather than a higher one in plain cost terms: pushing further out costs significantly more in hardware for a diminishing improvement, and the customers inside that last tenth of a percent were judged to be worth the machines. Whether or not you agree with where they drew the line, the shape of the sentence is the thing to copy. A latency requirement that names a bound, a percentile and a load can be tested and can be violated. Anything less is a preference.
What it actually claims
Dynamo is not one idea. It is a set of well-known techniques assembled so that each one covers a specific failure, and the paper's own contribution claim is the assembly and the production evidence, not the invention of the parts.
Follow one write through and the assembly stops being a list. A client sends a put, and whichever node coordinates it consults the preference list for that key, the first N healthy nodes clockwise from the key's position on the ring. It increments its own entry in the object's vector clock, which is nothing more cunning than a list of counters, one per node that has ever written this key, and sends the new value and clock to those N nodes. It answers the client as soon as W of them have acknowledged, so with the common setting of three replicas and a write quorum of two it is answering after two acknowledgements, not three. If one of the N is unreachable, the write is not held and is not rejected: it goes to the next healthy node on the ring carrying a hint that names its true owner, and that stand-in delivers it later when the owner comes back. That single substitution is the whole of always-writeable, and it is also, precisely, the moment two replicas can end up holding versions that neither descends from the other.
sequenceDiagram participant C as Client participant N1 as Coordinator participant N2 as Replica two participant N3 as Replica three unreachable participant N4 as Node four standing in C->>N1: put cart, plus the clock it read Note over N1: add one to its own<br/>entry in the clock N1->>N2: write with clock N1--xN3: write, no answer N1->>N4: write, hinted for replica three N2-->>N1: ok N4-->>N1: ok Note over N1: two acknowledgements,<br/>and the write quorum is two N1-->>C: success N4->>N3: hand the value over when it returns
Look at replica three and at node four. The write succeeded without the replica that owns the key, and a stand-in is holding the value on its behalf. Everything good about this design and everything expensive about it comes out of that one substitution: the client was never told no, and for a while two machines disagree about the cart.
- Consistent hashing, with virtual nodes
- Keys and nodes both land on a ring, and a key belongs to the first node clockwise. Adding or removing a node moves only that node's share of the keys instead of rehashing everything. Each physical machine takes many points on the ring rather than one, so load spreads evenly and a departing machine's work is inherited by many others rather than by its single neighbour.
- Replication to a preference list
- Each key is stored on the next N nodes around the ring, skipping positions that belong to a machine already holding it, so the N copies are on N distinct machines. Reads and writes are quorum-ish: a write waits for W acknowledgements, a read for R responses, and the operator picks N, R and W per store rather than getting one setting for everything.
- Sloppy quorum and hinted handoff
- When a replica is unreachable, the write does not fail and does not wait. It goes to the next healthy node on the ring, tagged with a hint saying who it was really for, and is delivered when that node comes back. This is what makes 'always writeable' true rather than aspirational, and it is also precisely the mechanism that produces divergent versions.
- Versioning with vector clocks
- A write carries a version, and versions form a partial order. When one version descends from another the system keeps the newer one silently. When neither descends from the other, Dynamo does not pick: it returns both to the client and expects the client to reconcile them.
- One hop to the data
- Every node knows the full membership and the whole ring, so a client's request can be routed to a node that actually holds the key in a single hop rather than walked around a distributed hash table. That is a deliberate departure from the peer-to-peer DHT designs Dynamo is otherwise built from, and it is a latency decision: the 99.9th-percentile target does not survive multi-hop routing. The bill arrives as membership state on every node, which is why the paper is explicit that the design targets a few hundred machines and not thousands.
- Read repair, and where reconciliation happens
- A read that collects R responses and finds them divergent does not just answer: it writes the reconciled version back. So the read path is one of the two repair mechanisms, and the busiest keys are the ones repaired most often. It is a neat property and it has a shadow: a key nobody reads is repaired only by the background anti-entropy, which is the slower of the two.
- Anti-entropy and gossip
- Replicas compare Merkle trees of their key ranges in the background, so a divergence that no reader happens to trip over is still found and repaired. Membership and failure information spreads by gossip. There is no central directory and no lookup hop, because every node knows enough to route directly.
- The three dials, and the setting almost everybody actually ran
- N, R and W are presented as tuneable and section 6 then reports what the tuning converged on: the common configuration across several Dynamo instances was three replicas with a read quorum of two and a write quorum of two. That is worth sitting with, because it is the shape of the trade rather than an arbitrary triple. Waiting for two acknowledgements out of three means one slow or dead machine never appears in your latency, which is the entire tail-latency argument. Lowering the write quorum to one makes writes faster and durability worse. Raising the read quorum to three makes reads see more and makes them as slow as the slowest replica. The paper also names the two configurations nobody should describe as quorums at all: a high write quorum with a read quorum of one for a read-heavy store, and its mirror. What the operator is choosing here is not a consistency level in the abstract, it is how many machines are allowed to be having a bad day before a customer notices.
- Buffered writes, and a durability trade made in the open
- Section 6.2 contains the most uncomfortable optimisation in the paper, and the reason to admire it is that it is measured rather than mentioned. To hit the tail-latency target, a node may accumulate writes in an in-memory buffer and have a writer thread flush them to disk periodically, while reads check the buffer first. The result is a factor of five reduction in 99.9th-percentile latency at peak traffic, from a buffer of only a thousand objects. The cost is stated in the same breath: a server crash loses whatever was buffered, so the design is refined to have the coordinator require one of the N replicas to perform a durable write before acknowledging, trading a little latency for the guarantee that the value exists on a disk somewhere. This is what a real durability decision looks like when it is written down, with the size of the buffer, the size of the win and the name of the risk all in one paragraph, instead of being buried in a configuration default.
- And the measurement that the whole argument rests on
- The paper does not only describe the mechanism, it reports what it did in production over 24 hours: 99.94% of requests saw exactly one version, and the remainder saw two, three or four. That number is offered as reassurance, divergence is rare, so the cost handed to the application is small. Read it twice. It is also the paper's most consequential sentence, for reasons the last section gets to.
The one idea worth stealing
Reconciliation belongs to whoever knows what the data means, and the storage layer's job is to preserve enough information that the decision is still possible when it gets there.
This is the part that generalises far beyond distributed stores. A conflict between two versions of a shopping cart is not a storage problem. There is no rule the database could apply that is right in general, but there is an obvious rule for a cart, which is to take the union of what was added, and an obvious and different rule for a counter, a set of permissions, or a document. Dynamo's move is to refuse to guess and hand both versions up, because the layer above is the only one with the information to be right.
There is a second move worth taking, smaller and more portable: N, R and W are set per store, by the team that owns the data, rather than once by the people who built the system. Durability against latency against read consistency is a trade whose right answer depends entirely on what the data is for, and Dynamo's refusal to pick one for everybody is why a session store and a cart could sit on the same infrastructure. Most systems ship a single default here and call it the design.
Steal the shape even when you never touch a quorum: when a lower layer cannot make a decision correctly, it should surface the ambiguity rather than resolve it by convention. Most systems do the opposite, and the convention is invisible until it is wrong.
The vector clock is worth stealing on its own, stripped of the ring around it, because what it does is cheap and general: it lets a receiver tell the difference between stale and conflicting. Two values arrive and you can ask whether one of them already knows everything the other does. If it does, that one wins and there is no conflict to speak of. If neither does, the two were written in ignorance of each other and no amount of comparing timestamps will make one of them correct. Any system with more than one writer faces that question: two tabs of the same form, an offline client syncing, a queue consumer processing a retry, and the ones that do not carry the bookkeeping are simply answering it by guessing. The cost is honest and bounded: an entry per writer, growing with the number of writers rather than the number of writes.
Steal the reporting style too. This paper tells you how often the awkward case actually happened, over a defined window, in production, with the distribution rather than a single number. Almost no design document does that, which is why so many arguments about consistency are conducted entirely in adjectives. If your system has a case the caller must handle, instrument how often it occurs before you argue about whether it matters, and put the number next to the mechanism, and then, unlike this paper, ask what a rate that low does to the odds of anybody's handler for it being correct.
What aged badly
Nothing in the mechanism was wrong. What aged badly is the assumption about who would use it.
- Almost nobody wrote the merge function
- Dynamo's design assumes an application author who will handle a multi-version read thoughtfully. In practice, teams adopting Dynamo-style stores in the years after overwhelmingly took the escape hatch, resolve by last-write-wins on a timestamp, because the alternative is writing and testing a merge for every object type. Last-write-wins is not a reconciliation strategy. It is a rule for choosing which write to discard, and it discards silently. The cost the paper puts on the application author turned out to be a cost most application authors declined to pay, and the data loss it produces has no error message attached.
- The paper's own reassuring number is the reason
- 99.94% of requests seeing exactly one version is presented as evidence that reconciliation is a small tax. It is better read as an explanation of why the tax went unpaid. A code path that runs on roughly one request in two thousand does not run in development, does not run in a test suite nobody wrote for it, and does not run in the first month of production. It runs later, on real customer data, in a branch that has never executed, and if that branch is last-write-wins, it does not fail, it silently discards. Rare-and-important is the hardest combination to build for, and the paper reports the rarity without drawing the conclusion.
- A sloppy quorum is not a quorum
- The most repeated line about Dynamo-style stores is that R + W > N gives you read-your-writes. It does not, in this design, and the paper's own mechanism is why: under hinted handoff a write can be acknowledged by W nodes that are not the W nodes a subsequent read will ask. The overlap the inequality promises is an overlap of the preference list, not of the machines that actually answered. Dynamo is honest about the mechanism. The inequality got quoted away from it, and a decade of engineers have reasoned about availability using an arithmetic that only holds when nothing has failed, which is the one condition under which none of this mattered.
- Vector clocks do not stay small
- A clock grows an entry per node that has written that key, and the paper is open about this: it describes truncating the oldest entries once a clock passes a threshold, and acknowledges that truncation can make reconciliation less exact. That is an admission that the versioning scheme's cost was not fully solved, and later systems mostly retreated to coarser schemes.
- The name outlived the design
- DynamoDB, the service most people now mean, is not this system. It came five years later, it is a managed service rather than a library-shaped store, and it does not expose vector clocks or client-side reconciliation. It offers strongly consistent reads as an option and later added transactions across items. Amazon's own trajectory is the strongest available evidence that the always-writeable, reconcile-in-the-client contract was too sharp an instrument for general use, the ideas survived, the interface did not.
- One key at a time, and the industry read it as a database
- Dynamo offers no isolation and no multi-key operations, single-key updates only, stated plainly in the paper as a scope decision that matched the services it was built for. What followed was a period in which that scope was read as a template for storage generally, and applications with genuinely relational shapes were built on stores that could not express them. The corrective took years and arrived as those same stores adding transactions back, one at a time.
- The ring stopped being how anyone places data
- Consistent hashing decides placement by arithmetic, which is exactly its appeal in 2007: no coordinator, no directory, no decision to make. It also means you cannot say where a partition should live. Modern systems overwhelmingly went the other way: an explicit partition map maintained by a control plane, because placement turns out to be something operators want to control: to balance a hot shard, to respect a failure domain, to keep data in a jurisdiction. The ring survives in Cassandra's lineage. The descendants that started later, DynamoDB included, do not use one.
- The repair machinery fights the placement scheme, and the paper admits it
- Background repair works by having replicas compare Merkle trees over the key ranges they share, which is efficient exactly as long as those ranges hold still. They do not. In the original scheme a node's position on the ring determines its ranges, so every time a node joins or leaves, ranges shift, and the trees covering them have to be recalculated from scratch before anti-entropy can resume. Section 6.2 says as much, and the partitioning strategies it goes on to evaluate exist largely to decouple partitioning from placement so that this stops happening. It is a good illustration of a general trap: two mechanisms that are each elegant alone can have an interaction that neither one's description mentions, and here the cost of the elegant placement scheme is paid by the unrelated repair subsystem, at the worst possible moment, which is while the cluster is already changing shape.
- The 99.9th-percentile framing is the part that did age well
- It is worth separating. The tail-latency argument: that a percentile is a statement about which customers you are willing to fail, and belongs in a contract rather than a dashboard, is now ordinary practice, and it came from here as much as anywhere.
- What to take from it today
- Do not build this. Do read section 2 for how to write a latency target, section 4 for the clearest short account of what a sloppy quorum actually is, and section 6 for the production numbers, which are still rarer than they should be. The lasting lessons are three. A guarantee is only as strong as the code path the caller writes to handle its exceptions, so a case that arises once in two thousand requests is a case that will be handled wrongly. If your system cannot resolve an ambiguity correctly, hand it upward rather than settling it by convention, and make the convention impossible to fall into accidentally. And when a mechanism costs something, publish the cost with a number and a window attached, the way this paper does, because a design that names its own bill is one you can still argue with fifteen years later. That is the only reason it is worth reading now, and it is a good enough one.
Related on chalk
The same idea as a board, lab, video or lesson.
- BoardThe Cut Phone Linethe choice Dynamo makes when the line is cut, drawn as a stall
- BoardSplitting the Ledgerthe ring Dynamo places keys on
- BoardThe Copy Clerksreplicas that run behind, which is the state Dynamo lives in
- BoardThe Ledger Everyone Readsthe promise a store makes to a reader, which is the thing Dynamo weakens
- LabThe cut phone lineanswer anyway or refuse, Dynamo answers anyway, every time
- LabThe ringconsistent hashing with virtual nodes, the partitioning scheme the paper uses
- LabSplitting the ledgerwhat a badly chosen key does to a ring
- LabThe copy clerksthe stale read you are agreeing to
- LabThe ledger everyone readswhich promise you made, eventual consistency is the weakest row
- VideoCAP: the cut phone linethe partition, in ninety seconds
- VideoSharding: splitting the ledgerwhy the keyspace gets cut up at all
- VideoReplication: the copy clerksthe lag between copies
- LessonKV: everythingUses the board The Cut Phone Line
- LessonThe cut phone line (CAP, done properly)Uses the board The Cut Phone Line
- LessonTwo kitchens, two cities (multi-region and active-active)Uses the board The Cut Phone Line
- LessonWhen the neighbour is slow: timeouts, retries, breakersUses the board The Cut Phone Line
- LessonKV: the ringUses the board Splitting the Ledger
- LessonSplitting the ledger (sharding)Uses the board Splitting the Ledger
- LessonChanging the engine in flight (live schema and data migrations)Uses the board Splitting the Ledger
- LessonKV: quorumUses the board The Copy Clerks
- LessonThe copy clerks (database replication)Uses the board The Copy Clerks
- LessonWhat did the database promise? (consistency models)Uses the board The Copy Clerks
- LessonBackups and the day you need them (RPO, RTO, and the restore nobody tested)Uses the board The Copy Clerks
- LessonCompute on borrowed disks: disaggregated storageUses the board The Copy Clerks
- LessonA Book You Never Erase, the append-only ledger, reversals and derived balancesUses the board The Ledger Everyone Reads
- LessonThe Ledger Everyone Reads (event-driven & the log)Uses the board The Ledger Everyone Reads
- LessonThe write that has to happen twice (CDC and the outbox)Uses the board The Ledger Everyone Reads
- LessonThe log is the truth (event sourcing and CQRS)Uses the board The Ledger Everyone Reads
- LessonDelete means delete (a user asks to be forgotten, and the data is in six places)Uses the board The Ledger Everyone Reads
Further reading
Read the original for the full argument and its evidence.