About this book
Designing Data-Intensive Applications was written by Martin Kleppmann and published by O'Reilly in 2017. It is a book about the machinery that stores, moves and transforms data inside modern software: databases, caches, search indexes, message brokers, batch jobs and stream processors. Its subject is not any one product. Its subject is the set of ideas and trade-offs that all these products share, so that a reader can look at a new system and understand what it is doing and what it is giving up.
The phrase in the title needs a word of explanation. Kleppmann distinguishes applications that are compute-intensive, where the hard part is raw processing power, from those that are data-intensive, where the hard part is the amount of data, its complexity and the speed at which it changes. Most business software, most web services and most mobile back ends are of the second kind. Their engineers spend little time worrying about CPU cycles and a great deal of time worrying about whether data is stored safely, read quickly, kept consistent across machines and changed without breaking older code.
The book appeared at a time of great confusion in this field. During the previous decade, a wave of new data systems had arrived, many grouped under the loose label NoSQL. They promised scale, flexibility and speed, and they were sold with energetic marketing. Older relational databases were sometimes dismissed as relics. Terms such as eventual consistency, ACID, CAP and big data were used everywhere, often loosely and sometimes wrongly. An engineer choosing a database had to wade through claims that were hard to check and vocabulary that meant different things to different vendors.
Kleppmann set out to cut through this. The question the book answers is roughly this: what are the fundamental problems that every data system must solve, what are the main known approaches to each, and what does each approach cost? Answer that, and the reader can evaluate any particular product by asking which approaches it uses. The book is therefore deliberately general. It mentions many real systems by name as examples, but it is careful to explain principles that will outlast them.
The intended reader is a working software engineer or architect who builds applications on top of data systems, and who wants to understand them well enough to choose among them, use them correctly and reason about their failures. The book does not require advanced mathematics, and it avoids formal proofs. It does require patience and a willingness to think carefully about concurrency and failure, which are the hardest parts of the subject. It is also useful to people who build data systems themselves, since it collects in one place ideas that are otherwise scattered across decades of research papers.
One feature sets the book apart. Every chapter ends with an extensive list of references to research papers, technical documentation, conference talks and blog posts. The book is, among other things, a guided tour of the literature of databases and distributed systems. A reader who wants to go deeper on any topic is never left without a path. This also signals the book's method: it does not claim to invent ideas, but to explain and connect ideas that others have developed, with careful credit.
The book became unusually popular for a technical work of its size and difficulty. It is often recommended as the single most useful book for engineers moving into back-end or infrastructure work, and it is widely used to prepare for system design interviews, a use the author did not especially intend. Its cover, showing a wild boar, became a familiar sight on engineers' desks.
The author
Martin Kleppmann came to this book from practice rather than from academia, and then moved into academia after writing it. That path explains much about its character. Earlier in his career he co-founded a small internet company that built a tool for adding information about contacts into email; it was acquired by LinkedIn. At LinkedIn he worked on large-scale data infrastructure, including the stream-processing system Samza, which was built to work with the Kafka messaging system that LinkedIn had developed. He was therefore writing as someone who had built and operated the kinds of systems he describes.
That experience with logs and streams shows clearly in the book. The idea that a log of events can be the foundation of a data system, from which many other views are derived, runs through its later chapters and represents a view that grew out of the LinkedIn engineering culture of that period. Kleppmann had written and spoken about this idea before the book, and the book places it in a broader framework.
While writing, and after, Kleppmann moved into research at the University of Cambridge. His later work has focused on distributed systems without central servers, on data structures that let many copies of a document be edited independently and merged automatically, known as CRDTs, and on the idea of local-first software, in which applications keep their primary copy of data on the user's own device. He has also worked on the formal verification of distributed algorithms and has taught distributed systems courses. These later interests are visible in seed form in the book, particularly in its discussion of conflict resolution and in its closing reflections.
The combination of practitioner and researcher is the book's main strength. A pure practitioner might have written a book of recipes tied to particular products. A pure academic might have written a book of proofs and models with little sense of what matters in production. Kleppmann writes as someone who has read the papers and also been paged when a system misbehaved. He is careful to say when a guarantee holds only in theory, when a product claims more than it delivers, and when an idea is elegant but rarely practical.
He also writes with an evident concern for the reader. Diagrams are frequent and clear. Terms are defined before they are used, and when a term is used inconsistently in the industry he says so and explains the variants. The tone is calm and slightly sceptical, never hyped. These are not small matters in a field where confusion about vocabulary has caused real data loss.
The shape of the argument
The book is divided into three parts, and the division carries the argument. The first part deals with the foundations of data systems as they exist on a single machine. The second part deals with what changes when data is spread across many machines. The third part deals with systems built from other systems, where data flows from one store to another and is transformed along the way.
The first part opens by defining what we want from a data system in general terms: that it keep working when things go wrong, that it cope with growth, and that it remain possible for people to understand and change over time. It then examines the different ways of modelling data, from tables to documents to graphs, and the query languages that go with them. It goes inside the storage engine to show how data is actually laid out on disk and how indexes are built. It ends with the problem of encoding data for storage or transmission, and of changing the format of that data over time without breaking older or newer code that still reads it.
The second part is the heart of the book and its most demanding section. It begins with replication, keeping copies of the same data on several machines, and then partitioning, splitting a large dataset across machines. It turns to transactions, the classic tool for keeping data correct when many operations happen at once. Then it steps back to describe, frankly and at length, the many ways in which distributed systems fail: networks that lose messages, clocks that disagree, processes that pause without warning. Finally it explains what guarantees can still be provided in such a world, including the strong guarantee that a distributed system behaves as if it were a single copy, and the algorithms by which machines reach agreement.
The third part changes perspective. Instead of looking at a single database, it looks at the whole architecture of an application, which typically uses several different stores for different purposes. It treats some data as the record of what happened and other data as derived from that record: caches, indexes, aggregates. It explains batch processing, which recomputes derived data from large inputs, and stream processing, which updates derived data continuously as new events arrive. It closes with a forward-looking chapter that proposes a way of thinking about data systems as dataflows, and ends with a reflection on the ethical responsibilities of engineers who build systems that collect personal data.
The movement of the argument is from small to large and from the familiar to the strange. A reader who knows how to use a relational database starts on firm ground. By the middle of the book, that ground has been undermined: the reader learns that transactions are weaker than assumed, that clocks cannot be trusted and that agreement among machines is expensive. The final part then rebuilds a picture of reliable systems from these more honest foundations, using logs and derived data instead of a single all-powerful database.
Idea one: reliability, scalability and maintainability
The book begins by naming three goals and defining each with more care than they usually receive. These three words are used everywhere in software and often mean little. Kleppmann gives them content.
Reliability means that the system continues to work correctly even when things go wrong. The things that go wrong are faults: a disk fails, a machine crashes, a programmer introduces a bug, an operator mistypes a command. A fault is not the same as a failure. A fault is a component deviating from its specification. A failure is the system as a whole stopping providing its service. The goal of reliable design is to prevent faults from becoming failures. This is why reliable systems are often tested by deliberately introducing faults, to see whether the system tolerates them. Kleppmann notes that human error is among the leading causes of outages, and that good design makes mistakes harder to make and easier to recover from.
Scalability means having reasonable ways to deal with growth. Kleppmann insists that it is not a single property a system either has or lacks. To talk about it meaningfully, one must first describe the load, using numbers that matter for the particular system: requests per second, the ratio of reads to writes, the number of simultaneous users, the size of data. Then one must describe performance, ideally using percentiles of response time rather than averages, because users who wait longest are often the most valuable or the most affected. Only then can one ask what happens to performance when load increases, and what resources must be added to keep performance steady.
He illustrates with a social media example, contrasting two ways of building a home timeline: compute it when the user asks, by gathering recent posts from everyone they follow, or compute it in advance, by pushing each new post into the timelines of all followers when it is written. The first is cheap to write and expensive to read. The second is the reverse. Which is better depends on the shape of the load, including the awkward fact that a few accounts have vast numbers of followers. The lesson is general: architecture is shaped by the particular load, and there is no one scalable design.
Maintainability means that many different people can work on the system productively over time. Kleppmann breaks it into three parts. Operability is making it easy for the people who run the system to keep it healthy. Simplicity is managing complexity so that new engineers can understand the system. Evolvability is making it easy to change the system as requirements change. These are soft goals compared with the first two, but over the life of a system they often matter most, since most cost comes after the first version ships.
An analogy: a bridge must stand up in storms, which is reliability. It must cope with more traffic as the town grows, which is scalability. And it must be inspectable, repairable and widenable by engineers who did not build it, which is maintainability. A bridge that excels at the first two but cannot be repaired is a poor bridge.
These ideas are often confused with each other and with performance. A fast system may be unreliable. A reliable system may not scale. A highly scalable system may be impossible to maintain. The book's opening move is to keep them distinct so that trade-offs between them can be seen. Where this leads is to a habit of asking, for any design choice, which of the three it serves and which it sacrifices.
Idea two: how data is modelled and stored
Kleppmann treats the data model as the most important decision in a system, because it shapes not only how software is written but how people think about the problem. He compares three main families. The relational model organises data into tables of rows, connected by references, and queried with a declarative language. The document model stores self-contained records, often as nested structures similar to JSON, which match the shape of objects in application code. The graph model represents data as nodes and edges, suited to highly interconnected information such as social networks or maps.
His treatment is even-handed. Document databases are convenient when data naturally forms self-contained trees and is usually loaded whole, such as a user profile with its list of jobs and schools. They become awkward when records refer to each other in many ways, because joins then have to be done in application code. Relational databases handle many-to-many relationships well and let the query planner decide how to fetch data. Graph databases handle data where anything may be related to anything. He shows that these models have converged over time, with relational systems adding document features and document systems adding joins, and that the history of databases includes earlier versions of the same debate.
He also draws out a distinction between declarative and imperative queries. A declarative query says what result is wanted, leaving the database free to decide how to get it. An imperative query spells out the steps. Declarative languages are easier to optimise and to parallelise, which is one reason SQL has lasted so long.
Below the data model is the storage engine, and here the book does something many readers find revelatory. It shows, starting from the simplest possible database, how real storage engines work. The simplest database appends each new record to the end of a file and searches the file to find a value. Writes are very fast and reads are very slow. Adding an index speeds up reads at the cost of slower writes. Every storage engine is a negotiation between these costs.
Two main families of engine are described. Log-structured engines write new data sequentially, keep sorted runs of data in files, and periodically merge those files in the background. They are very good at absorbing writes. Page-oriented engines, built around the B-tree, keep data in fixed-size pages arranged in a balanced tree and update pages in place. They give predictable reads and have been the standard for decades. Each has costs that show up under particular workloads: background merging can interfere with foreground work, and in-place updates require careful protection against crashes.
The book then distinguishes two broad kinds of workload. Transaction processing handles many small reads and writes, each touching a few records, as when a customer places an order. Analytics scans large amounts of data to compute aggregates, as when a manager asks for sales by region over a year. These workloads favour different storage layouts. Analytical systems often store data by column rather than by row, so that a query reading only a few columns of a wide table touches far less data, and so that similar values stored together compress well.
An analogy: a library can shelve books by order of arrival, which makes adding books trivial and finding them painful, or keep a card catalogue, which makes finding easy but requires updating cards for each new book. An archive used for research may keep entirely different indexes from one used for lending. The choice depends on how the library is used.
These ideas are often confused with brand loyalty. Engineers argue about products when the real question is which model and which engine suit the workload. Where it leads is to the ability to read a database's documentation and predict, from its storage design, how it will behave under your particular mix of reads and writes.
Idea three: data that must change shape over time
A theme that many books ignore receives a full treatment here: how data is encoded, and how that encoding can change without breaking things. In memory, data lives in objects, lists and maps connected by pointers. To store it in a file or send it over a network, it must be turned into a sequence of bytes. Formats for doing this range from language-specific serialisations to textual formats such as JSON and XML to compact binary formats with explicit schemas.
The deep problem is not encoding as such but evolution. Applications change. New fields are added, old fields are removed, types are refined. But in a running system, old and new versions of code coexist. During a rolling upgrade, some servers run the new version while others still run the old. Mobile apps on users' phones may be months out of date. Data written years ago remains in the database. So new code must read data written by old code, which is called backward compatibility, and old code must cope with data written by new code, which is called forward compatibility.
Kleppmann shows how different formats handle this. Language-specific formats tend to handle it badly and carry security risks. Textual formats are flexible but vague about types and offer no schema to check against. Binary formats with schemas, of which the book discusses several, assign each field a tag or rely on matching the writer's schema with the reader's, so that unknown fields can be skipped and missing fields filled with defaults. The rules for safe change follow: add fields as optional, never reuse a tag for a different meaning, remove fields only if they were optional.
He extends this to the ways data flows between processes: through databases, where data outlives the code that wrote it; through service calls, where clients and servers are upgraded independently; and through asynchronous messages, where producers and consumers may be different versions. Each path has its own compatibility concerns. He is sceptical of approaches that try to make remote calls look exactly like local function calls, since a network call can fail, time out or succeed without the caller knowing, in ways a local call cannot.
The analogy is with a language spoken across generations. Words are added and old words fall out of use, but grandparents and grandchildren can still mostly understand each other because change is gradual and rules of grammar are shared. A sudden switch to a new language would break the family conversation. Schema evolution is the discipline of changing a data language gradually enough that every generation of code can still talk.
This idea is often confused with versioning an API, which is one part of it. It is also confused with schema migration in a relational database, which handles the stored data but not the many running programs that read it. Where it leads is to treating the shape of data as a long-lived contract and designing changes with as much care as a public interface.
Idea four: copies and pieces of data across machines
When data outgrows one machine, or when one machine is too fragile to depend on, data must be spread out. There are two basic ways to do this, and the book treats each in depth. Replication keeps the same data on several machines. Partitioning, also called sharding, splits the data so that each machine holds a different part. Real systems usually combine them, with each partition replicated several times.
Replication serves several purposes: keeping data available when a machine fails, placing data closer to users in different regions, and spreading read traffic across many copies. The hard part is change. When data is written, every copy must eventually learn about the write, and in the meantime copies disagree. Kleppmann describes three main designs. In single-leader replication, all writes go to one designated node, which passes them on to followers. In multi-leader replication, several nodes accept writes and exchange them, which helps when data centres are far apart or devices work offline, but creates conflicts when the same data is changed in two places. In leaderless replication, clients write to several nodes directly and read from several nodes, using overlapping groups so that a read is likely to see the latest write.
Each design has its characteristic problems, and the book is particularly good on the effects of replication lag, the delay before a follower catches up. A user who updates their profile and then reloads the page may see the old version if the read goes to a lagging follower. A user who reads two pieces of related data from different followers may see an effect before its cause. Kleppmann names the guarantees that address these: reading your own writes, monotonic reads that never go backward in time, and consistent prefix reads that preserve the order of causally related writes. Naming them lets designers ask precisely which ones their application needs.
On conflicts, the book is frank that there is no general solution. A system can choose the write with the latest timestamp, but that silently discards data and depends on clocks, which are unreliable. It can keep all conflicting versions and ask the application or the user to merge them. Or it can use data types designed to merge automatically. This last approach, which became the focus of Kleppmann's later research, is introduced here.
Partitioning raises a different set of questions. How do you decide which machine holds which data? Splitting by ranges of keys keeps related data together and supports range queries, but risks hot spots where one partition gets most of the traffic. Splitting by a hash of the key spreads load evenly but scatters related records. Secondary indexes become complicated, since an index on a field other than the partition key must either be kept per partition, requiring queries to ask every partition, or partitioned globally, requiring writes to update several partitions. When machines are added or removed, data must be moved, and the book discusses strategies that limit how much moves.
An analogy: a company keeps its customer files in several offices. Replication means every office keeps a full copy, so any office can answer questions, but updates must be posted to all of them and may arrive late. Partitioning means each office holds customers whose surnames fall in a certain range, so the work is shared, but a question about all customers in one city requires calling every office.
These ideas are often confused with backups. A backup is a copy taken at a point in time for recovery. A replica is a live copy kept continuously in step, and it will faithfully replicate mistakes such as accidental deletions. Where these ideas lead is to recognising that every distributed database is a particular combination of replication and partitioning choices, and that its behaviour under failure follows from those choices.
Idea five: what transactions really promise
Transactions are one of the most important tools in data systems, and one of the most misunderstood. A transaction groups several reads and writes into a single unit that either succeeds completely or has no effect, and that appears isolated from other transactions running at the same time. The usual summary of the guarantees is the acronym ACID: atomicity, consistency, isolation and durability. Kleppmann examines each letter and finds that the acronym promises less than it seems to.
Atomicity, in this context, means that if a transaction fails partway, all its changes are undone. It is about the ability to abort, not about concurrency. Consistency means that the data satisfies the application's rules, but that is really the application's responsibility; the database can only enforce some rules, and the letter was arguably added to make the acronym work. Durability means that committed data will not be lost, though no system can guarantee this absolutely. Isolation is where the real subtlety lies.
In principle, isolation means that concurrent transactions behave as if they ran one after another. This is called serializability. In practice, many databases by default provide weaker levels of isolation, because full serializability has performance costs. These weaker levels prevent some anomalies and allow others. The book's great service is to name and explain those anomalies with concrete examples, so that a programmer can tell which ones might bite their application.
Some anomalies are familiar: reading data that another transaction has written but not committed, or overwriting another transaction's uncommitted write. Weaker isolation levels prevent these. Others are subtler. A lost update happens when two transactions read a value, each modify it, and each write it back, so that one modification is lost; two people incrementing the same counter is the classic case. Write skew happens when two transactions each read some data, make a decision based on it, and write to different records, so that each decision was valid on its own but together they break a rule. The book's example of this kind involves two doctors each going off call because each sees that the other is still on call, leaving nobody.
Kleppmann explains the techniques used to implement isolation. Snapshot isolation gives each transaction a consistent view of the database as of some point, which prevents many anomalies and is widely used, but does not prevent write skew. Serializability can be achieved by literally running transactions one at a time on a single thread, by two-phase locking, which makes transactions wait for each other, or by serializable snapshot isolation, which lets transactions proceed optimistically and aborts those that turn out to conflict. Each has a different performance profile.
An analogy: a shared kitchen calendar where family members book the car. If two people check the calendar at the same moment, each sees the car free, and each writes in a booking, the result is a double booking. Neither did anything wrong given what they saw. Only a rule that the second booking must check again, or that only one person may hold the calendar at a time, prevents the clash.
This idea is often confused with the belief that using a relational database makes data safe. Many relational databases do not provide serializable isolation by default, and applications written on that assumption contain bugs that appear only under concurrent load, which makes them very hard to find. Where it leads is to reading the documentation of a database's isolation levels with care and designing critical operations so that anomalies cannot occur.
Idea six: a world of partial failure
The chapter that many readers remember most vividly is a frank catalogue of everything that can go wrong in a distributed system. On a single computer, things tend to work or fail completely. In a network of computers, some parts fail while others continue, and the parts that continue often cannot tell what has happened. Kleppmann calls this partial failure, and it is the defining difficulty of the field.
Networks lose messages, delay them, deliver them out of order or deliver them twice. When one node sends a request and hears nothing back, it cannot know whether the request was lost, the remote node crashed, the remote node is slow, or the reply was lost. The only practical tool is a timeout, and choosing a timeout is a trade-off: too short, and healthy nodes are wrongly declared dead; too long, and real failures go undetected. The book stresses that in most real networks there is no upper bound on delay, so no timeout is perfectly safe.
Clocks are the next problem. Each machine has its own clock, and those clocks drift. They are corrected by synchronising with time servers, but synchronisation is imperfect and can cause a clock to jump backward. Kleppmann distinguishes time-of-day clocks, which try to match calendar time, from monotonic clocks, which only measure elapsed time on one machine. Using time-of-day clocks to order events across machines is dangerous: a write with a later timestamp may actually have happened earlier. Systems that resolve conflicts by keeping the latest write can silently lose data this way.
Processes pause. A program may stop for a significant time because of garbage collection, the operating system swapping memory to disk, a virtual machine being suspended, or many other causes. During the pause, the rest of the system carries on. When the program resumes, it may believe it still holds a lock or is still the leader, when in fact others have moved on. The book explains how such a stale node can corrupt data, and how a technique called fencing, in which each grant of authority carries an increasing number that storage checks, can protect against it.
From these problems the book draws a philosophical conclusion. In a distributed system, a node cannot trust its own judgement about the state of the world. Truth must be defined by agreement among a majority of nodes. If most nodes declare one node dead, it is dead for practical purposes, even if it believes itself alive. Designing correct systems requires reasoning about explicit models of what can fail: whether nodes can crash and recover, whether they can lie, and what timing assumptions hold.
An analogy: a group of people trying to coordinate by sending letters, where letters may be lost or delayed indefinitely, each person's watch runs at a slightly different speed, and anyone might fall asleep for an hour without knowing it. Under those conditions, nobody can be sure of anything alone. Only rules about what the majority has acknowledged allow progress.
This idea is often confused with pessimism. Kleppmann is not saying distributed systems cannot work; they work every day. He is saying they work only when designed around honest assumptions. Where it leads is to the next topic: what guarantees can still be built on top of such shaky ground.
Idea seven: consistency, order and agreement
Given a world of partial failure, what can a distributed system promise? The book examines a range of consistency guarantees, from weak to strong, and the cost of each.
The weakest common guarantee is eventual consistency: if writes stop, all replicas will eventually converge to the same value. This is useful but says nothing about what a reader sees in the meantime. The strongest common guarantee is linearizability: the system behaves as if there were a single copy of the data and every operation took effect at one instant. Once any client has seen a new value, no client can see the old one. This is what most programmers naively assume, and it is expensive to provide, because it requires coordination among nodes and can make a system unavailable when the network is disrupted.
Here the book addresses the famous CAP theorem, often stated as saying a system can have at most two of consistency, availability and partition tolerance. Kleppmann argues that this popular statement is misleading. Network partitions are not optional; they happen. The real choice is what to do when they happen: stay consistent and refuse some requests, or stay available and risk inconsistency. He also points out that the theorem uses narrow definitions and says nothing about latency or about many other failures, so it is of limited help in designing real systems. This critique was valuable because CAP had become a slogan used to justify all sorts of design choices.
Between the extremes lies causality. Causal consistency ensures that if one event could have influenced another, everyone sees them in that order, while unrelated events may be seen in different orders. This captures much of what users care about, such as seeing a question before its answer, and is cheaper than linearizability. The book explains how sequence numbers and logical clocks can track causal order.
Many problems reduce to the problem of getting nodes to agree. Electing a single leader, assigning unique usernames, committing a transaction across several databases, and maintaining a totally ordered log of operations are all versions of consensus. The book explains two-phase commit, a protocol for atomic commitment across nodes, and shows its weakness: if the coordinator fails at the wrong moment, participants can be left waiting indefinitely. It then discusses fault-tolerant consensus algorithms that can make progress as long as a majority of nodes are working, and explains that such algorithms are equivalent to providing a totally ordered broadcast of messages. It notes that most applications use consensus indirectly, through coordination services built for that purpose.
An analogy: a committee taking decisions by post. Eventual consistency means everyone will eventually have the same minutes. Linearizability means the committee behaves as if it met in one room with one secretary. Consensus is the procedure by which members agree on each decision despite lost letters and absent members, and it works only if a majority can still be reached.
This idea is often confused with the database setting called consistency, or with the C in ACID, which mean different things. Kleppmann notes that the word is overloaded and asks readers to always ask which kind is meant. Where it leads is to a clear question for any system: which guarantee does this operation actually need, and is the cost worth it?
Idea eight: systems of record and derived data
The third part of the book proposes a way of seeing whole architectures. Most applications use several data systems: a main database, a cache for speed, a search index, an analytics warehouse, perhaps a recommendation model. Keeping them in step is a constant source of bugs. Kleppmann offers a clarifying distinction. A system of record holds the authoritative version of some data. Derived data is anything that can be recomputed from the system of record: caches, indexes, materialised views, aggregates, trained models. If derived data is lost or wrong, it can be rebuilt.
Batch processing is one way to produce derived data. A batch job takes a large, fixed input, processes it and produces output, without modifying the input. Kleppmann draws a line from the Unix philosophy of small programs connected by pipes to the large-scale batch frameworks that followed, showing that both rest on the same principles: immutable inputs, outputs that can be thrown away and regenerated, and composition of simple steps. Because inputs are never changed, a buggy job can simply be fixed and rerun. He then describes how later dataflow engines improved on earlier frameworks while keeping these principles.
Stream processing applies the same idea to data that never stops arriving. Events are recorded in a log, an append-only sequence, and processors read from the log and update derived views continuously. The book explains how log-based message brokers differ from traditional queues: a log keeps messages in order and retains them, so new consumers can start from the beginning and old consumers can replay. It introduces change data capture, in which every change to a database is published as a stream, so that other systems can stay in step. It discusses event sourcing, in which the application records each event as an immutable fact and derives current state from the history.
This leads to the closing proposal. Kleppmann suggests that the database might be seen not as a single box but as a set of functions, storage, indexing, caching and querying, which could be assembled from separate components connected by logs. He calls this unbundling the database. Instead of trusting one product to do everything, an application treats its event log as the source of truth and builds whatever specialised views it needs. Correctness then rests on careful handling of the dataflow: making operations idempotent so they can be safely repeated, carrying identifiers end to end so that duplicates can be detected, and checking integrity continuously.
The analogy is with accounting. A ledger records every transaction in order and is never erased; mistakes are corrected by adding new entries. Balances, reports and tax forms are all derived from the ledger. If a report is wrong, you recompute it from the ledger. Event-based architectures apply this old discipline to software.
The book then closes with a section on doing the right thing. Kleppmann asks engineers to consider the consequences of the systems they build, particularly systems that collect and analyse personal data. He discusses how predictive analytics can harden discrimination, how surveillance can become normal through convenience, and how consent to data collection is often not meaningful. It is an unusual ending for a technical book and a deliberate one.
This idea is often confused with a recommendation to use one particular streaming product. It is a way of thinking, applicable whether the log is a dedicated system or a table in a relational database. Where it leads is to architectures in which data flows in one direction from facts to views, which are easier to reason about, to repair and to evolve.
Idea nine: correctness as an end-to-end property
Running through the whole book, and made explicit near its end, is a view of correctness that is easy to state and hard to practise. A guarantee provided by one component does not automatically become a guarantee for the whole application. A database may provide serializable transactions, but if a user's request is retried by a mobile client after a timeout, the same purchase can still be recorded twice. A message broker may deliver each message at least once, but the consumer that processes it must still cope with seeing the same message again. The guarantee that matters is the one the user experiences, and that guarantee can only be secured by thinking about the whole path from user action to stored result.
Kleppmann draws on an old principle from network design, sometimes called the end-to-end argument, which holds that certain functions can only be implemented completely at the endpoints of a system. Lower layers can help, often greatly, but they cannot finish the job. Applied to data, this means that the application must carry an identifier for each operation from the moment the user starts it, so that any later step can recognise a duplicate. It means that operations should be designed to be idempotent, so that doing them twice has the same effect as doing them once. And it means that checks for integrity should be built in at several points, not left to a single trusted component.
He also separates two ideas that are often merged under the word consistency. Timeliness means that users see an up-to-date state. Integrity means that the data is not corrupted, lost or contradictory. Violations of timeliness are usually temporary and annoying: a user sees an old value for a few seconds. Violations of integrity can be permanent and serious: money disappears, or an order exists without its payment. Many systems can relax timeliness considerably while keeping integrity strict, and doing so often removes the need for expensive coordination. A bank statement that takes a few hours to show a transfer is tolerable; a transfer that debits one account without crediting the other is not.
This leads to a modest but important suggestion about trust. Rather than assuming that hardware, databases and libraries always behave as documented, systems should verify their own data from time to time, in the way that careful accountants reconcile ledgers. Auditing, checksums and periodic comparisons between a system of record and its derived views catch the rare cases where some component has silently misbehaved. Kleppmann notes that such silent corruption, though uncommon, does occur at large scale, and that a system which never checks will never notice.
An analogy is a parcel service. The sorting depot may be excellent, and the vans may be reliable, but the only thing the customer cares about is whether the right parcel arrived at the right door once. That requires a tracking number attached at the start and checked at the end, and it requires the driver to recognise when a parcel has already been delivered rather than delivering it twice.
This idea is often confused with distrust of databases. Kleppmann is not advising engineers to abandon transactions or reimplement storage. He is advising them to understand exactly what each layer promises and to close the remaining gaps in the application. Where it leads is to systems that remain correct under retries, partial failures and reprocessing, which in practice means systems that users can trust with things that matter to them.
The tradition around it
Designing Data-Intensive Applications is a synthesis of several research traditions that had grown apart. One is database research, going back to the relational model of the 1970s, the theory of transactions and concurrency control developed in the following decades, and the work on storage structures such as the B-tree. Another is distributed systems research, with its formal models of failure, its results about what is and is not possible, and its consensus algorithms. A third is the engineering of very large web services in the 2000s and 2010s, which produced many papers describing in-house systems for storage, batch processing and streaming. Kleppmann's achievement is to bring these together in one readable account, with references back to the original sources.
It answers, above all, the NoSQL period. By explaining what each new system actually traded away, it helped engineers see that the choice was not old versus new but one set of guarantees versus another. In doing so it partly rehabilitated ideas that had been unfashionable, such as strong transactions and declarative queries, while also explaining what the newer systems had genuinely contributed.
Within this bay, its closest companion is Site Reliability Engineering, the account of how Google runs production systems. That book discusses distributed consensus, data integrity and overload from an operator's point of view; Kleppmann provides the underlying theory. Reading them together shows both why distributed systems fail and how teams keep them running anyway. Computer Systems: A Programmer's Perspective by Bryant and O'Hallaron supplies the single-machine foundations, such as memory hierarchies, caches and how disks and operating systems behave, that make the storage chapters easier to follow. The UNIX Programming Environment by Kernighan and Pike lays out the pipes-and-filters philosophy that Kleppmann explicitly connects to batch processing.
Domain-Driven Design by Eric Evans is relevant to the data modelling chapters and to event-based architecture, since event sourcing grew partly from that community. A Philosophy of Software Design by John Ousterhout offers a complementary view of complexity at the level of modules and interfaces, and its notion of deep modules applies well to databases, which hide enormous complexity behind small query interfaces. Algorithms + Data Structures = Programs by Niklaus Wirth is an older reminder that the structure of data shapes the structure of programs, which is a theme of this book at a much larger scale.
Since 2017 the field has moved on in several directions the book anticipated. Distributed SQL databases that offer strong transactions across many machines have become more common. Stream processing has matured. Conflict-free replicated data types and local-first software, the subjects of Kleppmann's later research, have grown from research topics into practical libraries. Cloud data warehouses that separate storage from computation have become standard for analytics.
Questions and criticisms
The most frequent criticism is length and density. The book is long, and its middle part demands sustained concentration. Some readers find that the breadth, covering nearly every major topic in data systems, means that no single topic is treated to the depth a specialist would want. This is the price of a survey. The references are the answer: the book is designed as a map, not a complete territory.
A second criticism is that the book is better at explaining trade-offs than at telling readers what to choose. It rarely says use this database for that purpose. Some readers want firmer guidance. The author's restraint is deliberate, since product recommendations date quickly and depend on circumstances, but readers looking for a decision procedure must build their own from the principles.
A third concerns currency. The products named as examples have changed since publication. Some have faded, others have gained features that the book describes them as lacking, and new categories have emerged. The principles hold, but a reader should check any claim about a specific product against current documentation. The rise of fully managed cloud databases has also changed what most teams must understand: many no longer operate replication or partitioning themselves, though they still live with the consequences.
A fourth is that the closing proposal, unbundling the database into logs and derived views, is presented with enthusiasm and has proved harder in practice than its elegance suggests. Event-driven architectures bring their own complexity: schema evolution of events, reprocessing costs, debugging across asynchronous flows and the difficulty of supporting queries that need strong consistency. Many teams that adopted event sourcing enthusiastically later retreated. Kleppmann acknowledges some of these difficulties, but the chapter reads more as a vision than as settled practice.
Some readers have also noted that the ethics section, though welcome, is brief compared with the technical material, and does not connect closely to the design techniques that precede it. Others value it precisely because it appears at all.
What has held up is the core. The definitions of reliability, scalability and maintainability are still used. The account of storage engines remains accurate. The treatment of isolation anomalies is still one of the clearest available and continues to prevent real bugs. The critique of loose talk about CAP and consistency shaped how a generation of engineers discusses these topics. The emphasis on immutable logs and derived data has influenced architecture widely, even where full event sourcing was not adopted.
Why it is on this shelf
This book is on the shelf because it teaches a way of thinking about trade-offs that applies far beyond databases. Every design choice it describes gains something and gives something up, and the book's discipline is to name both sides clearly. That habit is useful to anyone who must make decisions under constraints, in engineering, in economics or in ordinary life.
It belongs near the economics books because so much of it is about scarce resources: disk bandwidth, network capacity, coordination cost, the attention of the people who maintain systems. The choice between computing a result when it is written and computing it when it is read is a choice about when to pay a cost, much like an economic choice between investment and consumption.
It belongs near the science books because of its method. It insists on precise definitions, distinguishes models from reality, states assumptions explicitly and cites its sources. Its treatment of partial failure, where no observer can be sure of the global state and truth is established by agreement among many, will interest any reader who has thought about knowledge and observation.
For a reader of Vedanta, the chapter on distributed systems offers an unexpected echo. A node cannot trust its own view of the world; its clock may be wrong, it may have been paused without knowing, and what it believes to be current may already be past. Reliable conduct comes from recognising the limits of one's own perception. We note the echo without pressing it.
And it is here because data now underlies nearly every serious undertaking. To understand how records are kept, copied, ordered and repaired is to understand something basic about the infrastructure of modern life.
How to read it
Plan for several weeks. This is not a book to read in a weekend, and its value comes from understanding, not coverage.
Begin with the first chapter, on reliability, scalability and maintainability, read slowly. It sets the vocabulary for everything else. Then read the chapter on storage and retrieval, which is the most immediately illuminating for most programmers; work through its diagrams with a pencil, drawing for yourself how a log-structured engine merges files and how a B-tree splits pages. The chapter on data models can be read lightly on first pass if you already know relational and document databases.
Next read replication, then transactions. Give the transactions chapter the most time of any in the book. For each anomaly it describes, write down an example from a system you know where it could occur, and decide which isolation level would prevent it. This exercise alone justifies the book.
Then read the chapter on the trouble with distributed systems in one sitting if you can; it builds a mood as well as an argument. Follow it with the chapter on consistency and consensus, which is the hardest in the book. It is acceptable on first reading to grasp the main guarantees, linearizability, causality and total order, and the outline of consensus, and to return to the details later. The chapters on partitioning and encoding can be read in between, at any point.
For the third part, read batch processing for its connection to Unix pipes and its argument about immutable inputs, then stream processing for logs and change data capture. Read the final chapter as an essay. Read the closing section on ethics with care; it is short.
Skip on first pass the detailed comparison of particular encoding formats and the finer points of specific consensus algorithms. Do not skip the references entirely: pick two or three papers from the chapters that matter most to you and read them.
From this shelf, read Site Reliability Engineering next for the operational side of the same systems. Read Computer Systems: A Programmer's Perspective first if the storage chapters feel unfamiliar. Read A Philosophy of Software Design afterwards for the design of the code that sits on top of these systems.
Questions to carry
- What is the load on this system, described in numbers, and which number would break it first?
- Which users experience the slowest responses, and why are they the ones who matter most?
- Is this data naturally a tree of documents, a set of related tables or a web of connections?
- Does this workload mostly write, mostly read, or mostly scan, and does the storage engine match?
- If the format of this data changes next year, which running programs will still need to read the old form?
- What happens to a user who writes data and immediately reads it back from a different replica?
- Where could two concurrent transactions each make a valid decision that together breaks a rule?
- What isolation level does this database actually use by default, and has anyone checked?
- Which parts of this system rely on clocks agreeing across machines?
- What would a paused process that wakes up believing it is still in charge be able to damage?
- Which operations here truly need linearizability, and which would be satisfied by causal order?
- Which data in this architecture is the system of record, and which could be rebuilt from it?
- If a derived view were found to be wrong, could it be recomputed, and how long would that take?
- Who is affected by the data this system collects, and did they meaningfully agree?
Words to know
- Data-intensive application: software whose main difficulty lies in the volume, complexity or rate of change of its data rather than in computation.
- Fault: a component deviating from its specification, such as a failed disk or crashed process.
- Failure: the system as a whole ceasing to provide its required service.
- Load parameters: the numbers that describe the demand on a particular system, such as requests per second or the read to write ratio.
- Percentile: the value below which a given fraction of measurements fall, used to describe response times more honestly than averages.
- Log-structured storage: a storage design that appends writes sequentially and merges sorted files in the background.
- B-tree: a balanced tree of fixed-size pages, updated in place, used as the standard index structure in many databases.
- Column-oriented storage: storing each column of a table together, which speeds up analytical queries and improves compression.
- Backward compatibility: newer code can read data written by older code.
- Forward compatibility: older code can read data written by newer code, usually by ignoring what it does not understand.
- Replication lag: the delay before a change on one replica appears on others.
- Leader: in replication, the node that accepts writes and passes them on to followers.
- Partitioning: splitting a dataset so that different machines hold different parts; also called sharding.
- Hot spot: a partition that receives a disproportionate share of load.
- Transaction: a group of reads and writes treated as a single unit that either fully succeeds or has no effect.
- Isolation level: the degree to which concurrent transactions are protected from seeing or affecting each other's work.
- Serializability: the strongest isolation guarantee, where concurrent transactions behave as if run one at a time.
- Snapshot isolation: an isolation level in which each transaction reads from a consistent snapshot of the database.
- Write skew: an anomaly where concurrent transactions read overlapping data, write to different records and together violate a rule.
- Linearizability: the guarantee that a distributed system behaves as if there were a single copy of the data with instantaneous operations.
- Causal consistency: the guarantee that operations related as cause and effect are seen in that order by everyone.
- Consensus: the problem of getting several nodes to agree on a value despite failures.
- Fencing token: an increasing number attached to a grant of authority, used to reject requests from nodes whose authority has expired.
- Change data capture: publishing every change made to a database as a stream that other systems can consume.
- Event sourcing: storing the full history of application events as immutable facts and deriving current state from them.
A note on this edition
This is a study edition written for the shelf in our own words. It describes and discusses Designing Data-Intensive Applications but does not reproduce it, and its examples and analogies are our own except where noted as the book's. The book itself is in copyright, published by O'Reilly, and is worth getting from a library or bookshop. Its diagrams and its references in particular repay reading in the original.