Skip to content

About

Notes for the book "Designing Data Intensive Applications"

Topics

Resources

Stars

69 stars

Watchers

0 watching

Forks

Latest commit

 

History

9 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Designing-Data-Intensive-Applications

This repository explains the concepts from "Designing Data-Intensive Applications" by Martin Kleppmann, with chapter-by-chapter breakdowns and practical examples.

Read it chapter by chapter, or study one topic at a time with the Reading paths and Topics by theme sections below.

Chapters

  • Chapter 1: Reliable, Scalable, and Maintainable Applications - Foundation chapter covering the three fundamental concerns in software systems: reliability (fault tolerance), scalability (handling growth), and maintainability (operability, simplicity, evolvability).

  • Chapter 2: Data Models and Query Languages - Comprehensive exploration of data models including relational (SQL), document (NoSQL), and graph databases, along with their query languages, trade-offs, and when to use each model.

  • Chapter 3: Storage and Retrieval - Deep dive into how databases store and retrieve data, covering hash indexes, SSTables, LSM-trees, B-trees, and the differences between OLTP (row-oriented) and OLAP (column-oriented) storage engines.

  • Chapter 4: Encoding and Evolution - Comprehensive guide to data encoding formats (JSON, XML, Thrift, Protocol Buffers, Avro), schema evolution strategies, backward/forward compatibility, and dataflow patterns through databases, services, and message queues.

  • Chapter 5: Replication - Explores replication strategies including single-leader, multi-leader, and leaderless replication, along with handling consistency challenges and conflicts.

  • Chapter 6: Partitioning - Covers partitioning strategies (sharding) for scalability, including key-range and hash-based partitioning, secondary indexes, rebalancing techniques, and request routing approaches.

  • Chapter 7: Transactions - Deep dive into ACID properties, isolation levels (Read Committed, Snapshot Isolation, Serializable), concurrency control mechanisms (2PL, MVCC, SSI), and distributed transactions with two-phase commit.

  • Chapter 8: The Trouble with Distributed Systems - Explores the fundamental challenges of distributed systems including unreliable networks, clock synchronization issues, process pauses, partial failures, Byzantine faults, and system models for reasoning about failures.

  • Chapter 9: Consistency and Consensus - Comprehensive coverage of consistency models (from eventual consistency to linearizability), ordering guarantees, causality, consensus algorithms (2PC, Paxos, Raft), and coordination services (ZooKeeper, etcd, Consul) for building fault-tolerant distributed systems.

  • Chapter 10: Batch Processing - In-depth exploration of batch processing systems from Unix tools to MapReduce and modern dataflow engines (Spark, Flink), covering distributed filesystems (HDFS), join algorithms, graph processing (Pregel model), fault tolerance strategies, and the evolution toward declarative SQL interfaces.

  • Chapter 11: Stream Processing - Comprehensive guide to stream processing covering event streams, message brokers (Kafka), change data capture (CDC), event sourcing, stream joins (stream-stream, stream-table), windowing operations, handling time and late events with watermarks, fault tolerance with exactly-once semantics, and comparison of stream processing frameworks.

  • Chapter 12: The Future of Data Systems - Integrating everything together: data integration patterns, unbundling databases, derived data with Lambda and Kappa architectures, CQRS, end-to-end correctness with idempotence, enforcing constraints in distributed systems, trust and verification with audit logs, and ethical considerations for privacy and fairness in data systems design.

Studying by topic

Every link below jumps straight to the section that covers a topic, so you don't need to read the whole chapter.

  • Reading paths are ordered lists of sections for a specific goal.
  • Topics by theme list each concept with:
    • Start here: the section that explains it.
    • Also see: other sections, often in other chapters, where the idea comes up again.
    • Read first: what you need to know for the section to make sense. Skip it if you already know the material.

Reading paths

How a database stores data

  1. Ch 3 · The Simplest Database
  2. Ch 3 · Hash Indexes
  3. Ch 3 · SSTables and LSM-Trees
  4. Ch 3 · B-Trees
  5. Ch 3 · B-Tree vs LSM-Tree
  6. Ch 7 · How Durability Works (write-ahead log)
  7. Ch 3 · Transaction Processing vs Analytics
  8. Ch 3 · Column-Oriented Storage

Scaling out: replication and partitioning

  1. Ch 1 · Approaches for Coping with Load
  2. Ch 5 · Leaders and Followers
  3. Ch 5 · Synchronous vs. Asynchronous Replication
  4. Ch 5 · Problems with Replication Lag
  5. Ch 5 · Leaderless Replication
  6. Ch 6 · Partitioning of Key-Value Data
  7. Ch 6 · Partitioning and Secondary Indexes
  8. Ch 6 · Rebalancing Partitions
  9. Ch 6 · Request Routing

Transactions and isolation levels

  1. Ch 7 · The ACID Properties
  2. Ch 7 · Read Committed
  3. Ch 7 · Snapshot Isolation
  4. Ch 7 · Lost Updates
  5. Ch 7 · Write Skew and Phantoms
  6. Ch 7 · Serializable Isolation
  7. Ch 7 · Two-Phase Commit

From unreliable systems to consensus

  1. Ch 8 · Faults and Partial Failures
  2. Ch 8 · Unreliable Networks
  3. Ch 8 · Unreliable Clocks
  4. Ch 8 · Process Pauses
  5. Ch 8 · The Truth is Defined by the Majority
  6. Ch 9 · Linearizability
  7. Ch 9 · The Cost of Linearizability (CAP)
  8. Ch 9 · Causality
  9. Ch 9 · Total Order Broadcast
  10. Ch 9 · Raft Consensus Algorithm
  11. Ch 9 · Apache ZooKeeper

Event-driven and streaming architectures

  1. Ch 4 · Modes of Dataflow
  2. Ch 11 · Message Brokers vs Event Logs
  3. Ch 11 · Apache Kafka Architecture
  4. Ch 11 · Change Data Capture
  5. Ch 11 · Event Sourcing
  6. Ch 11 · Time in Stream Processing
  7. Ch 11 · Fault Tolerance
  8. Ch 12 · Data Integration
  9. Ch 12 · Derived Data (Lambda and Kappa)
  10. Ch 12 · End-to-End Argument for Data Systems

System design interview essentials

  1. Ch 1 · Describing Load and Describing Performance
  2. Ch 3 · B-Tree vs LSM-Tree
  3. Ch 5 · Leaders and Followers
  4. Ch 5 · Problems with Replication Lag
  5. Ch 5 · Writing and Reading with Quorum
  6. Ch 6 · Consistent Hashing
  7. Ch 6 · Skewed Workloads and Hot Spots
  8. Ch 7 · Isolation Levels
  9. Ch 9 · The Cost of Linearizability (CAP)
  10. Ch 9 · Consensus Algorithms
  11. Ch 11 · Apache Kafka Architecture
  12. Ch 12 · Exactly-Once Semantics

Topics by theme

Foundations

Topic Start here Also see Read first
Faults vs failures Ch 1 · Reliability Hardware Faults, Software Errors, Human Errors —
Load parameters and fan-out Ch 1 · Describing Load — —
Latency percentiles (p99) Ch 1 · Describing Performance — Describing Load
Scaling up vs scaling out Ch 1 · Approaches for Coping with Load Ch 6 · Why Partition Data? Describing Load
Operability, simplicity, evolvability Ch 1 · Maintainability Ch 4 · Schema Evolution —

Data models and query languages

Topic Start here Also see Read first
Relational vs document model Ch 2 · Relational Model vs Document Model Comparison, Choosing a Data Model —
One-to-many, many-to-many relationships Ch 2 · One-to-Many Relationships Many-to-One and Many-to-Many Relational vs Document
Schema-on-read vs schema-on-write Ch 2 · Schema Flexibility Ch 4 · Schema Evolution Relational vs Document
Data locality Ch 2 · Data Locality — The Document Model
Declarative vs imperative queries Ch 2 · Declarative vs Imperative Ch 10 · Declarative Query Languages —
MapReduce as a query model Ch 2 · MapReduce Aggregation Pipeline, Ch 10 · MapReduce Job Execution Declarative vs Imperative
Graph data models Ch 2 · Graph Databases Property Graphs, Triple Stores, When to Use Graph Databases —

Storage engines and indexes

Topic Start here Also see Read first
Append-only logs and indexes Ch 3 · The Simplest Database Indexes —
Hash indexes, compaction, segments Ch 3 · Hash Indexes Compaction, Segmentation The Simplest Database
SSTables and LSM-trees Ch 3 · SSTables and LSM-Trees How to Create SSTables, Compaction Strategies Hash Indexes
Bloom filters Ch 3 · LSM-Tree Read Path — SSTables and LSM-Trees
B-trees Ch 3 · B-Trees B-Tree Search, B-Tree Insert Indexes
B-tree vs LSM-tree trade-offs Ch 3 · B-Tree vs LSM-Tree — SSTables and LSM-Trees, B-Trees
Write-ahead log (WAL) Ch 7 · How Durability Works Ch 5 · WAL Shipping —
Secondary, clustered, multi-column, full-text indexes Ch 3 · Other Indexing Structures Ch 6 · Partitioning and Secondary Indexes Indexes
OLTP vs OLAP, data warehouses Ch 3 · Transaction Processing vs Analytics Data Warehousing, Star Schema —
Column-oriented storage and compression Ch 3 · Column-Oriented Storage Column Compression, Sort Order in Columns, Writing to Column-Oriented Storage Transaction Processing vs Analytics
Materialized views and data cubes Ch 3 · Data Cubes and Materialized Views Ch 12 · Derived Data Column-Oriented Storage

Encoding and schema evolution

Topic Start here Also see Read first
JSON, XML, CSV and their pitfalls Ch 4 · JSON, XML, and CSV Language-Specific Formats —
Thrift and Protocol Buffers Ch 4 · Thrift and Protocol Buffers Binary Encoding JSON, XML, and CSV
Backward and forward compatibility Ch 4 · Schema Evolution Adding Fields, Removing Fields, Changing Field Types Thrift and Protocol Buffers
Avro writer's and reader's schema Ch 4 · Avro Writer's vs Reader's Schema, Avro vs Thrift/Protocol Buffers Schema Evolution
Dataflow through databases, REST/RPC, messaging Ch 4 · Modes of Dataflow Ch 11 · Message Brokers vs Event Logs Schema Evolution

Replication

Topic Start here Also see Read first
Single-leader replication Ch 5 · Leaders and Followers Why Replicate Data?, Setting Up New Followers —
Synchronous vs asynchronous replication Ch 5 · Synchronous vs. Asynchronous Replication — Leaders and Followers
Failover and its pitfalls Ch 5 · Leader Failure: Failover Ch 8 · Split Brain Problem, Ch 9 · Leader Election Leaders and Followers
Replication log formats Ch 5 · Replication Logs Implementation Ch 11 · Change Data Capture Leaders and Followers
Read-your-writes, monotonic reads, consistent prefix Ch 5 · Problems with Replication Lag Read-After-Write, Monotonic Reads, Consistent Prefix Reads, Ch 9 · Spectrum of Consistency Models Synchronous vs. Asynchronous
Multi-leader replication and write conflicts Ch 5 · Multi-Leader Replication Handling Write Conflicts, Collaborative Editing (OT, CRDTs) Leaders and Followers
Leaderless replication and quorums Ch 5 · Leaderless Replication Writing and Reading with Quorum, Quorum Consistency Limitations, Sloppy Quorums and Hinted Handoff Problems with Replication Lag
Read repair and anti-entropy Ch 5 · Read Repair Anti-Entropy Process Leaderless Replication
Concurrent writes, LWW, version vectors Ch 5 · Detecting Concurrent Writes Last Write Wins, Version Vectors, Ch 9 · Capturing Causality with Version Vectors Leaderless Replication

Partitioning

Topic Start here Also see Read first
What partitioning is Ch 6 · What is Partitioning? Partitioning vs. Replication Ch 5 · Leaders and Followers
Key-range vs hash partitioning Ch 6 · Partitioning of Key-Value Data By Key Range, By Hash of Key What is Partitioning?
Consistent hashing Ch 6 · Consistent Hashing Don't Hash Mod N Partitioning by Hash of Key
Hot spots and skew Ch 6 · Skewed Workloads and Hot Spots Ch 10 · Handling Skew Partitioning by Hash of Key
Local vs global secondary indexes Ch 6 · Partitioning and Secondary Indexes Comparison: Local vs. Global, Ch 3 · Secondary Indexes Partitioning of Key-Value Data
Rebalancing strategies Ch 6 · Rebalancing Partitions Comparison of Rebalancing Strategies, Automatic vs. Manual Partitioning of Key-Value Data
Request routing and gossip Ch 6 · Request Routing Coordination Service, Gossip Protocol, Ch 9 · Service Discovery Rebalancing Partitions

Transactions

Topic Start here Also see Read first
What ACID means Ch 7 · The ACID Properties Atomicity, Consistency, Isolation, Durability —
Abort and retry Ch 7 · Abort and Retry Ch 12 · Duplicate Suppression Atomicity
Choosing an isolation level Ch 7 · Isolation Levels Choosing an Isolation Level, Real-World Database Isolation Isolation
Read committed (dirty reads and writes) Ch 7 · Read Committed No Dirty Reads, No Dirty Writes Isolation Levels
Snapshot isolation and MVCC Ch 7 · Snapshot Isolation MVCC Read Committed
Lost updates Ch 7 · Lost Updates Solutions to Lost Updates Snapshot Isolation
Write skew and phantoms Ch 7 · Write Skew and Phantoms Solutions to Write Skew, Ch 12 · Uniqueness Constraints Lost Updates
Serial execution, 2PL, SSI Ch 7 · Serializable Isolation Actual Serial Execution, Two-Phase Locking, SSI Write Skew and Phantoms
Distributed transactions and 2PC Ch 7 · Distributed Transactions Two-Phase Commit, Ch 9 · Two-Phase Commit, Ch 9 · Three-Phase Commit Atomicity

Faults, networks and clocks

Topic Start here Also see Read first
Partial failures Ch 8 · Faults and Partial Failures Ch 1 · Reliability —
Unreliable networks and fault detection Ch 8 · Unreliable Networks Detecting Faults Faults and Partial Failures
Timeouts and unbounded delays Ch 8 · Timeouts and Unbounded Delays Network Congestion and Queueing Unreliable Networks
Time-of-day vs monotonic clocks, NTP Ch 8 · Types of Clocks Clock Synchronization —
Ordering events by timestamp Ch 8 · Timestamps for Ordering Events Relying on Synchronized Clocks, Ch 5 · Last Write Wins Types of Clocks
Process pauses, leases, fencing tokens Ch 8 · Process Pauses Fencing Tokens (Revisited), Ch 9 · Distributed Locks with ZooKeeper Types of Clocks
Majority quorums and split brain Ch 8 · The Truth is Defined by the Majority Split Brain Problem, Ch 5 · Leader Failure: Failover Process Pauses
Byzantine faults Ch 8 · Byzantine Faults Weak Forms of Lying The Truth is Defined by the Majority
System models, safety and liveness Ch 8 · System Models Timing Assumptions, Node Failure Models, Algorithm Correctness Unreliable Networks

Consistency, ordering and consensus

Topic Start here Also see Read first
The spectrum of consistency models Ch 9 · Consistency Guarantees Ch 5 · Problems with Replication Lag —
Linearizability Ch 9 · Linearizability Example: Non-Linearizable System, Implementing Linearizability Ch 5 · Problems with Replication Lag
Linearizability vs serializability Ch 9 · Linearizability vs. Serializability — Linearizability, Ch 7 · Serializable Isolation
CAP theorem Ch 9 · The Cost of Linearizability — Linearizability
Causality and happens-before Ch 9 · Causality Happens-Before Relationship, Version Vectors, Ch 5 · Consistent Prefix Reads —
Lamport timestamps Ch 9 · Sequence Numbers and Total Ordering Ch 8 · Timestamps for Ordering Events Causality
Total order broadcast Ch 9 · Total Order Broadcast Ch 7 · Consensus and Total Order Broadcast Sequence Numbers and Total Ordering
Consensus and Raft Ch 9 · Consensus Algorithms Raft, Consensus System Invariants, Performance Limitations Total Order Broadcast, Ch 8 · System Models
FLP impossibility Ch 9 · The FLP Impossibility Result — Ch 8 · Timing Assumptions
ZooKeeper and coordination services Ch 9 · Membership and Coordination Services ZooKeeper Data Model, Leader Election with ZooKeeper, Alternatives to ZooKeeper Consensus Algorithms
Distributed locks Ch 9 · Distributed Locks with ZooKeeper Ch 8 · Fencing Tokens (Revisited) Ch 8 · Process Pauses

Batch processing

Topic Start here Also see Read first
The Unix philosophy Ch 10 · Batch Processing with Unix Tools The Unix Philosophy, The Unix Pipe —
Sorting vs in-memory aggregation Ch 10 · Sorting vs In-Memory Aggregation Ch 3 · How to Create SSTables Simple Log Analysis
MapReduce and HDFS Ch 10 · MapReduce and Distributed Filesystems MapReduce Job Execution, Distributed Filesystem, MapReduce Workflows Batch Processing with Unix Tools
Joins and group-by in batch jobs Ch 10 · Joins in MapReduce Group By in MapReduce, Handling Skew MapReduce Job Execution
Dataflow engines (Spark) Ch 10 · Beyond MapReduce Dataflow Engines, Apache Spark, Materialization of Intermediate State MapReduce Workflows
Fault tolerance in batch jobs Ch 10 · Fault Tolerance in Dataflow Engines Ch 11 · Fault Tolerance Dataflow Engines
Graph processing (Pregel, BSP) Ch 10 · Graph Processing Bulk Synchronous Parallel, Graph Partitioning, Ch 2 · Graph Databases MapReduce Job Execution
Comparing batch systems Ch 10 · Comparing Batch Processing Systems Declarative Query Languages Beyond MapReduce

Stream processing

Topic Start here Also see Read first
Message brokers vs event logs Ch 11 · Message Brokers vs Event Logs Ch 4 · Dataflow Through Message Passing —
Kafka architecture Ch 11 · Apache Kafka Architecture — Message Brokers vs Event Logs, Ch 6 · Partitioning of Key-Value Data
Log compaction Ch 11 · Log Compaction Ch 3 · Compaction Apache Kafka Architecture
Change data capture (CDC) Ch 11 · Change Data Capture Ch 5 · Logical (Row-Based) Log Replication Apache Kafka Architecture
Event sourcing Ch 11 · Event Sourcing Ch 12 · Designing Applications Around Dataflow Databases and Streams
Complex event processing and stream analytics Ch 11 · Processing Streams Complex Event Processing, Stream Analytics Message Brokers vs Event Logs
Event time, windows, watermarks Ch 11 · Time in Stream Processing Ch 8 · Unreliable Clocks Stream Analytics
Stream-stream, stream-table, table-table joins Ch 11 · Stream Joins Ch 10 · Joins in MapReduce Time in Stream Processing
Microbatching, checkpointing, idempotence Ch 11 · Fault Tolerance Checkpointing, Idempotence, Ch 12 · Exactly-Once Semantics Processing Streams
Comparing stream frameworks Ch 11 · Stream Processing Frameworks Comparison — Fault Tolerance

Data integration and system design

Topic Start here Also see Read first
Single source of truth Ch 12 · Data Integration Better Approach: Single Source of Truth Ch 11 · Change Data Capture
Unbundling databases Ch 12 · Unbundling Databases Composing Data Storage Technologies Data Integration
CQRS Ch 12 · Designing Applications Around Dataflow — Ch 11 · Event Sourcing
Lambda vs Kappa architecture Ch 12 · Derived Data Lambda Architecture, Kappa Architecture Ch 10 · MapReduce Job Execution, Ch 11 · Stream Analytics
Exactly-once and idempotence end to end Ch 12 · End-to-End Argument Exactly-Once Semantics, Duplicate Suppression, Ch 11 · Idempotence Ch 7 · Abort and Retry
Constraints without coordination Ch 12 · Enforcing Constraints Uniqueness Constraints, Timeliness and Integrity, Coordination-Avoidance Ch 9 · Total Order Broadcast
Auditing and verification Ch 12 · Trust, But Verify Auditing, Designing for Auditability —
Privacy and ethics Ch 12 · Doing the Right Thing Privacy and Data Protection —

About

Notes for the book "Designing Data Intensive Applications"

Topics

Resources

Stars

69 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages