DDIA Lab/ chapters 0/12 chapters
The whole book

Every chapter, briefly.

Designing Data-Intensive Applications in one scroll: what each of the 12 chapters covers, the book sections it walks through, and five takeaways worth remembering. Open any chapter to step through it as an interactive diagram.

PART I

Foundations of Data Systems

What makes a system reliable, scalable and maintainable — and the data models, storage engines and encodings everything else is built on.

Chapter 1

Reliable, Scalable, and Maintainable Applications

PDF p.25–48 14 min

The three concerns behind every data system — and how to reason about them with numbers, not buzzwords.

Thinking About Data SystemsReliabilityScalabilityMaintainability
In this chapter
  • Why an app is really a data system built from smaller tools
  • Faults vs failures — and the three kinds of fault
  • Describing load with Twitter's home timelines
  • Why percentiles beat averages for response time
  • Operability, simplicity and evolvability
Key takeaways
  1. 1Most applications are data-intensive: the hard part is the amount, complexity and speed of change of data, not CPU.
  2. 2Reliability means the system keeps working correctly even when hardware, software or humans make faults.
  3. 3Scalability is not a label — describe load with load parameters and performance with response-time percentiles.
  4. 4Scaling up and scaling out are both valid; the right architecture depends on your specific load parameters.
  5. 5Maintainability rests on operability, simplicity (good abstractions) and evolvability.
Chapter 2

Data Models and Query Languages

PDF p.49–90 15 min

Relational, document and graph models — what each makes easy, what it makes awkward, and how you ask them questions.

Relational Model Versus Document ModelQuery Languages for DataGraph-Like Data Models
In this chapter
  • How the relational model won — and why NoSQL appeared
  • When documents fit: one-to-many trees and locality
  • Schema-on-read vs schema-on-write
  • Why declarative queries beat imperative code
  • Property graphs, triple-stores, Cypher, SPARQL and Datalog
Key takeaways
  1. 1Data models are layered, and the model you pick shapes how you think about the problem.
  2. 2Document databases suit self-contained, tree-shaped data with few relationships between documents.
  3. 3Relational databases handle many-to-one and many-to-many relationships well through joins.
  4. 4Graph models suit data where anything may relate to anything, and recursive traversal is common.
  5. 5Declarative query languages let the database optimize, parallelize and evolve without changing your queries.
Chapter 3

Storage and Retrieval

PDF p.91–132 16 min

What happens inside a database when you write a key and read it back — logs, LSM-trees, B-trees and column stores.

Data Structures That Power Your DatabaseTransaction Processing or Analytics?Column-Oriented Storage
In this chapter
  • Why every index speeds reads but slows writes
  • Hash indexes, segments and compaction (Bitcask)
  • SSTables and LSM-trees: memtable, flush, merge
  • B-trees, pages and the write-ahead log
  • OLTP vs OLAP, star schemas and column storage
Key takeaways
  1. 1An append-only log is the fastest way to write; indexes are extra structures that trade write cost for read speed.
  2. 2Log-structured engines (Bitcask, LSM-trees) only append and merge files, turning random writes into sequential ones.
  3. 3B-trees update fixed-size pages in place and rely on a write-ahead log for crash safety.
  4. 4OLTP serves many small key-based lookups; OLAP scans huge numbers of rows — so warehouses are built differently.
  5. 5Column-oriented storage reads only the columns a query needs and compresses them extremely well.
Chapter 4

Encoding and Evolution

PDF p.133–166 14 min

How data is turned into bytes — and how to keep old and new code talking while everything changes.

Formats for Encoding DataModes of Dataflow
In this chapter
  • Backward vs forward compatibility
  • The trouble with language-specific formats and JSON
  • How field tags make Thrift and Protobuf evolvable
  • Avro's writer's schema vs reader's schema
  • Dataflow through databases, services and message brokers
Key takeaways
  1. 1Rolling upgrades mean old and new code — and old and new data — exist side by side, so you need both backward and forward compatibility.
  2. 2Language-specific serialization and loosely-specified text formats (JSON, XML, CSV) have real pitfalls with numbers, binary data and schemas.
  3. 3Binary schema-driven formats (Thrift, Protocol Buffers, Avro) are compact and have clear rules for evolving schemas.
  4. 4Data outlives code: a database may hold records written by every version of your app.
  5. 5Services (REST/RPC) and async message brokers each need compatible encodings across independently deployed versions.
PART II

Distributed Data

Spreading data across machines: replication, partitioning, transactions, the many ways networks and clocks lie, and how consensus restores order.

Chapter 5

Replication

PDF p.173–220 16 min

Keep copies of the same data on many machines — and survive everything that goes wrong when they drift apart.

Leaders and FollowersProblems with Replication LagMulti-Leader ReplicationLeaderless Replication
In this chapter
  • Why replicate: latency, availability and read scaling
  • How leader-based replication and failover work
  • Replication-lag anomalies and the guarantees that fix them
  • When multi-leader makes sense — and its write conflicts
  • Leaderless quorums and detecting concurrent writes
Key takeaways
  1. 1Replication keeps copies of the same data on several machines for availability, lower latency and higher read throughput.
  2. 2Single-leader replication routes every write through one node; failing over when that node dies is subtle and risky.
  3. 3Asynchronous replication causes lag, so applications may need read-your-writes, monotonic reads and consistent prefix guarantees.
  4. 4Multi-leader and leaderless setups accept writes on many nodes, which makes conflict resolution unavoidable.
  5. 5Quorums with w + r > n usually give fresh reads, and version vectors tell truly concurrent writes apart from ordered ones.
Chapter 6

Partitioning

PDF p.221–242 14 min

Split a dataset too big for one machine into shards — without creating hot spots or losing track of where each key lives.

Partitioning and ReplicationPartitioning of Key-Value DataPartitioning and Secondary IndexesRebalancing PartitionsRequest Routing
In this chapter
  • How partitioning combines with replication
  • Key-range vs hash partitioning, and their hot spots
  • Local (document) vs global (term) secondary indexes
  • Rebalancing strategies that move as little data as possible
  • How a request finds the partition that owns its key
Key takeaways
  1. 1Partitioning splits a large dataset so each record lives in exactly one partition, spreading data and query load across nodes.
  2. 2Key-range partitioning keeps keys sorted for efficient range scans but risks hot spots; hash partitioning spreads load evenly but loses ordering.
  3. 3Hashing cannot fix a single hot key — the application has to split that key itself.
  4. 4Document-partitioned indexes make writes cheap and reads scatter/gather; term-partitioned (global) indexes do the opposite.
  5. 5Never rebalance with hash mod N; use many fixed partitions or dynamic splitting, plus a coordination service such as ZooKeeper for routing.
Chapter 7

Transactions

PDF p.243–294 18 min

Pretend concurrency and crashes don't exist — and learn exactly which race conditions each isolation level lets through.

The Slippery Concept of a TransactionWeak Isolation LevelsSerializability
In this chapter
  • What ACID really promises (and what it doesn't)
  • Read committed and snapshot isolation via MVCC
  • Lost updates, write skew and phantoms
  • Three ways to get serializability
  • Why 2PL is pessimistic and SSI is optimistic
Key takeaways
  1. 1A transaction groups several reads and writes into one unit that commits entirely or aborts entirely, so the application can simply retry.
  2. 2In ACID, atomicity means abortability, consistency is really an application property, isolation hides concurrency and durability survives crashes.
  3. 3Read committed prevents dirty reads and dirty writes; snapshot isolation (MVCC) additionally prevents read skew.
  4. 4Lost updates and write skew slip through weak isolation — fix them with atomic operations, explicit locks or serializability.
  5. 5Serializability comes from actual serial execution, two-phase locking (pessimistic) or serializable snapshot isolation (optimistic).
Chapter 8

The Trouble with Distributed Systems

PDF p.295–342 17 min

Networks drop messages, clocks lie and processes freeze. A tour of everything that can go wrong once data spans machines.

Faults and Partial FailuresUnreliable NetworksUnreliable ClocksKnowledge, Truth, and Lies
In this chapter
  • Why partial failures make distributed systems hard
  • Why timeouts are the only fault detector — and how to pick one
  • Time-of-day vs monotonic clocks, and the danger of clock skew
  • How process pauses break leases, and fencing tokens fix them
  • Byzantine faults, system models, safety and liveness
Key takeaways
  1. 1In a distributed system, parts fail independently and nondeterministically — partial failure is the normal state of affairs.
  2. 2Networks can lose, delay or duplicate messages without telling you; a timeout is the only signal, and it can't tell a dead node from a slow one.
  3. 3Clocks drift and jump, so never order events across machines by wall-clock time, and treat every timestamp as a range with uncertainty.
  4. 4A process can pause for seconds at any point, so a node can't trust its own sense of time — protect leases and locks with fencing tokens.
  5. 5Truth is decided by a quorum of nodes, and algorithms are proven correct only within an explicit system model of timing and failures.
Chapter 9

Consistency and Consensus

PDF p.343–406 18 min

From “eventually the same” to “everyone agrees right now” — and what that agreement costs.

Consistency GuaranteesLinearizabilityOrdering GuaranteesDistributed Transactions and Consensus
In this chapter
  • What linearizability promises — and how it differs from serializability
  • Why CAP really means “consistent or available when partitioned”
  • How causality and Lamport timestamps order events without a global clock
  • How two-phase commit works, and why a crashed coordinator blocks everyone
  • What consensus guarantees and why ZooKeeper/etcd exist
Key takeaways
  1. 1Linearizability makes a replicated system behave as if there were a single copy of the data, with every operation taking effect atomically at one instant.
  2. 2Linearizability is needed for locks, leader election and uniqueness constraints, but it is slow and becomes unavailable during network partitions.
  3. 3Causal consistency is weaker but much cheaper; Lamport timestamps give a total order that respects causality, yet can’t decide things like username uniqueness in real time.
  4. 4Total order broadcast, linearizable compare-and-set, atomic commit and leader election are all equivalent to consensus.
  5. 5Fault-tolerant consensus (Raft, Paxos, Zab) uses epochs and majority quorums; most apps should outsource it to ZooKeeper or etcd rather than inventing their own.
PART III

Derived Data

Systems that compute data from other data: batch jobs, event streams, and how to compose them into correct, humane applications.

Chapter 10

Batch Processing

PDF p.411–460 16 min

Crunch a huge, fixed pile of input into derived data — from Unix pipes to MapReduce and Spark.

Batch Processing with Unix ToolsMapReduce and Distributed FilesystemsBeyond MapReduce
In this chapter
  • How online services, batch jobs and stream processors differ
  • What the Unix philosophy teaches about composable data processing
  • How map → shuffle → reduce runs on a distributed filesystem
  • Reduce-side vs map-side joins, and what to do about hot keys
  • Why dataflow engines like Spark and Flink replaced plain MapReduce
Key takeaways
  1. 1Batch jobs read a bounded, immutable input and produce derived output; they’re judged by throughput, not latency.
  2. 2Unix tools show the core ideas: a uniform interface, small composable programs, and inputs that are never modified.
  3. 3MapReduce runs mappers next to the data on a distributed filesystem, sorts and shuffles their output by key, then reduces each key group.
  4. 4Joins can happen in reducers (sort-merge) or in mappers (broadcast or partitioned hash joins) when you know more about the inputs.
  5. 5Dataflow engines (Spark, Tez, Flink) pipeline operators instead of writing every intermediate result to disk, recovering from faults by recomputation.
Chapter 11

Stream Processing

PDF p.461–510 17 min

When the input never ends: brokers, logs, change data capture, windows and joins over events in motion.

Transmitting Event StreamsDatabases and StreamsProcessing Streams
In this chapter
  • How traditional message brokers differ from log-based brokers like Kafka
  • Why dual writes go wrong and how change data capture fixes them
  • What event sourcing is and why immutable events help
  • Event time vs processing time, and the four kinds of windows
  • Stream joins and how stream processors get exactly-once results
Key takeaways
  1. 1A stream is an unbounded sequence of small, immutable events; producers publish them and consumers subscribe via a broker.
  2. 2AMQP/JMS-style brokers delete messages once acknowledged, while log-based brokers (Kafka) keep an ordered, partitioned log that consumers read by offset and can replay.
  3. 3Change data capture and event sourcing turn a database into a stream, keeping search indexes, caches and warehouses in sync without fragile dual writes.
  4. 4Stream processors must reason about event time vs processing time, straggling events and windows (tumbling, hopping, sliding, session).
  5. 5Fault tolerance with “effectively once” semantics comes from microbatching, checkpointing, atomic commits and idempotent writes.
Chapter 12

The Future of Data Systems

PDF p.511–574 16 min

Compose many specialised tools around a log, build apps as dataflow, verify correctness end to end — and use data responsibly.

Data IntegrationUnbundling DatabasesAiming for CorrectnessDoing the Right Thing
In this chapter
  • Why derived data via an ordered log beats distributed transactions for integration
  • Lambda vs. unified batch-and-stream architectures, and gradual reprocessing
  • What “unbundling the database” means for application design
  • How end-to-end request IDs prevent duplicate side effects
  • Timeliness vs. integrity, auditing, and the ethics of data
Key takeaways
  1. 1No single tool fits every access pattern, so real systems combine databases, indexes, caches and warehouses kept in sync from one system of record.
  2. 2Deriving data asynchronously through an ordered event log is more robust and scalable than keeping systems in sync with distributed transactions.
  3. 3“Unbundling” treats indexes, caches and materialized views as derivation functions over a log — application code becomes dataflow.
  4. 4Exactly-once inside one system isn’t enough: end-to-end request IDs and idempotent operations prevent duplicates across the whole path.
  5. 5Integrity matters more than timeliness; audit and verify continuously, and treat personal data with care — predictions and surveillance have real human costs.