DDIA Lab/ cheatsheets 0/12 chapters
Cheatsheets

The book on one page.

The ladders to memorize, the side-by-side comparisons that come up in every design review, and every term from the 12 chapters.

Ladders & sequences

Isolation levels (weak → strong)
1 Read uncommitted→2 Read committed→3 Snapshot isolation→4 Serializable
Consistency models (weak → strong)
1 Eventual→2 Read-your-writes→3 Monotonic reads→4 Consistent prefix→5 Causal→6 Linearizable
Replication topologies
1 Single-leader→2 Multi-leader→3 Leaderless (quorums)
Replication log formats
1 Statement-based→2 Write-ahead log shipping→3 Logical (row-based) log→4 Trigger-based
Achieving serializability
1 Actual serial execution→2 Two-phase locking (2PL)→3 Serializable snapshot isolation (SSI)
Two-phase commit
1 Get transaction ID→2 Write on participants→3 Prepare (vote)→4 Coordinator logs decision→5 Commit / abort
A MapReduce job
1 Read & split input→2 Map → key-value pairs→3 Partition + sort (shuffle)→4 Reduce per key→5 Write output
Stream joins
1 Stream–stream (window)→2 Stream–table (enrichment)→3 Table–table (view maintenance)

Side by side

LSM-tree vs B-tree
LSM-treeB-tree
WritesSequential appends; high throughputIn-place page overwrites
ReadsMay check several SSTablesOne root-to-leaf path
SpaceCompaction removes garbage; compresses wellFragmentation; pages partly empty
Pain pointCompaction can stall writesWrite amplification via WAL + page
OLTP vs OLAP
OLTPOLAP
ReadsFew records by keyAggregates over many rows
WritesRandom, low latencyBulk loads (ETL) or streams
UsersEnd users via the appAnalysts, BI dashboards
StorageRow-orientedColumn-oriented, compressed
Batch vs stream processing
BatchStream
InputBounded, known sizeUnbounded, arrives forever
LatencyMinutes to hoursMilliseconds to seconds
FailuresRerun the failed taskCheckpoints, idempotence
ExampleMapReduce, SparkKafka Streams, Flink

Glossary

163 terms

Data-intensive application

Ch 1

An application whose main challenge is the amount, complexity or rate of change of data, rather than CPU power.

Elastic

Ch 1

Able to automatically add computing resources when load increases.

Failure

Ch 1

The system as a whole stops providing the required service to the user.

Fan-out

Ch 1

The number of downstream requests or writes triggered by one incoming request, as in delivering a tweet to every follower.

Fault

Ch 1

One component of the system deviating from its specification.

Fault tolerance

Ch 1

Designing a system so that faults are prevented from causing failures.

Head-of-line blocking

Ch 1

A few slow requests holding up the processing of requests queued behind them.

Load parameters

Ch 1

Numbers that describe load, e.g. requests per second, read/write ratio, active users or cache hit rate.

Maintainability

Ch 1

How easy a system is to operate, understand and change over its lifetime: operability, simplicity, evolvability.

Reliability

Ch 1

The system continues to work correctly, at the desired performance, even in the face of faults and human error.

Response time percentile

Ch 1

The response time below which a given share of requests fall — p50 is the median, p99 means 99% are faster.

Scalability

Ch 1

A system's ability to cope with increased load, discussed in terms of concrete load parameters.

Scaling up / scaling out

Ch 1

Moving to a more powerful machine (vertical) versus spreading load across many machines (horizontal, shared-nothing).

Tail latency

Ch 1

The high-percentile (p99, p999) response times experienced by the slowest requests.

Cypher

Ch 2

Neo4j's declarative query language for property graphs, using arrow-style patterns.

Data locality

Ch 2

Storing related data together so it can be loaded in one go, as a document does for its nested data.

Data model

Ch 2

The abstraction used to represent data — relational tables, JSON documents, graphs — which shapes how problems are solved.

Datalog

Ch 2

A rule-based query language from the 1980s whose ideas underpin many graph query languages.

Declarative query

Ch 2

A query that describes the result wanted, leaving the database to decide how to compute it (e.g. SQL).

Document model

Ch 2

Data stored as self-contained documents (often JSON) that can nest one-to-many structures.

Impedance mismatch

Ch 2

The awkward translation layer between objects in application code and tables, rows and columns.

Many-to-one / many-to-many

Ch 2

Relationships where many records refer to one (or many) others; they require joins to query.

Normalization

Ch 2

Storing each piece of information in exactly one place and referring to it by ID, avoiding duplication.

Property graph

Ch 2

A graph model where vertices and edges each have a label and a set of key–value properties (Neo4j, Cypher).

Relational model

Ch 2

Data organized into relations (tables) of tuples (rows), queried declaratively, proposed by Edgar Codd in 1970.

Schema-on-read

Ch 2

The structure of data is implicit and interpreted only when data is read (like dynamic typing).

Schema-on-write

Ch 2

An explicit schema enforced by the database, so all written data conforms to it (like static typing).

Triple-store

Ch 2

A graph store that keeps every fact as a (subject, predicate, object) triple, queried with SPARQL.

Append-only log

Ch 3

A file that is only ever added to at the end — the simplest and fastest way to write data.

B-tree

Ch 3

A balanced tree of fixed-size pages updated in place; the most widely used index structure.

Bloom filter

Ch 3

A compact probabilistic structure that can say a key is definitely absent, avoiding unnecessary disk reads.

Column-oriented storage

Ch 3

Storing all values of each column together, so queries read only the columns they need.

Compaction

Ch 3

Rewriting log segments to discard overwritten or deleted values, keeping only the latest value per key.

Data warehouse

Ch 3

A separate, read-optimized database for analytics, loaded from OLTP systems via ETL.

Hash index

Ch 3

An in-memory hash map from each key to the byte offset of its value in a data file, as in Bitcask.

Index

Ch 3

An additional structure derived from primary data that speeds up reads at the cost of slower writes.

LSM-tree

Ch 3

Log-Structured Merge-tree: a storage engine built on memtables and SSTables that are merged in the background.

Memtable

Ch 3

An in-memory sorted tree that buffers recent writes before they are flushed to disk as an SSTable.

OLTP / OLAP

Ch 3

Online transaction processing (small key-based reads/writes for users) vs online analytic processing (large aggregate scans).

SSTable

Ch 3

Sorted String Table: an immutable segment file whose key–value pairs are sorted by key.

Star schema

Ch 3

A warehouse layout with a central fact table of events referencing surrounding dimension tables.

Tombstone

Ch 3

A special record marking a key as deleted, so compaction knows to discard earlier values.

Write amplification

Ch 3

One logical write causing multiple physical writes to disk over the database's lifetime.

Write-ahead log (WAL)

Ch 3

An append-only file to which every change is written before it is applied, used for crash recovery.

Avro

Ch 4

A compact binary encoding from Hadoop with no field tags, decoded by resolving writer's and reader's schemas.

Backward compatibility

Ch 4

Newer code can read data that was written by older code.

Encoding (serialization)

Ch 4

Translating in-memory data structures into a self-contained sequence of bytes; decoding is the reverse.

Field tag

Ch 4

The number that identifies a field in Thrift/Protobuf encodings; it must never change or be reused.

Forward compatibility

Ch 4

Older code can read data that was written by newer code, ignoring parts it doesn't understand.

Message broker

Ch 4

An intermediary that stores messages and delivers them to consumers asynchronously (e.g. RabbitMQ, Kafka).

MessagePack

Ch 4

A binary encoding of JSON that is somewhat smaller but still includes field names in every record.

Protocol Buffers

Ch 4

Google's schema-driven binary encoding that identifies fields by numeric tags.

REST

Ch 4

A design philosophy for web services built on HTTP features, URLs and simple data formats.

Rolling upgrade

Ch 4

Deploying a new version to a few nodes at a time, so old and new versions run side by side.

RPC

Ch 4

Remote procedure call: making a request to a remote service look like calling a local function.

Schema evolution

Ch 4

Changing a schema over time while keeping old and new data and code compatible.

Thrift

Ch 4

Facebook's schema-driven binary encoding and RPC framework, with Binary and Compact protocols.

Writer's schema / reader's schema

Ch 4

In Avro, the schema used to encode the data versus the schema the decoding application expects.

Eventual consistency

Ch 5

If writes stop, replicas eventually converge to the same value — with no bound on how long that takes.

Failover

Ch 5

Promoting a follower to leader after the old leader fails, then redirecting writes to it.

Follower (replica)

Ch 5

A replica that applies the leader's changes in the same order and serves reads.

Last write wins (LWW)

Ch 5

Resolving conflicts by keeping the write with the largest timestamp and discarding the rest.

Leader (primary)

Ch 5

The single replica that accepts writes and decides their order in leader-based replication.

Monotonic reads

Ch 5

A guarantee that a user never sees older data after having seen newer data.

Multi-leader replication

Ch 5

Several nodes accept writes and replicate to each other; useful across datacenters and for offline clients.

Quorum (w + r > n)

Ch 5

Requiring w write acks and r read responses out of n replicas so the read and write sets overlap.

Read-your-writes

Ch 5

A guarantee that users always see their own updates after making them (read-after-write consistency).

Replication

Ch 5

Keeping copies of the same data on several machines for availability, lower latency and read scaling.

Replication lag

Ch 5

The delay between a write on the leader and that write appearing on a follower.

Split brain

Ch 5

Two nodes both believing they are the leader and accepting conflicting writes.

Synchronous replication

Ch 5

The leader waits for a follower to confirm a write before reporting success — durable but blocks if the follower stalls.

Version vector

Ch 5

One version counter per replica, used to tell whether two writes are causally ordered or concurrent.

Compound primary key

Ch 6

A key whose first part picks the partition by hash while the remaining parts stay sorted within it (Cassandra).

Dynamic partitioning

Ch 6

Splitting a partition when it grows too large and merging small ones, like a B-tree (HBase, MongoDB).

Fixed number of partitions

Ch 6

Creating many more partitions than nodes up front, so rebalancing moves whole partitions, not keys.

Global (term-partitioned) index

Ch 6

A secondary index partitioned by the indexed value; fast reads, slower and often asynchronous writes.

Hash partitioning

Ch 6

Assigning keys to partitions by a hash of the key — even load, but no efficient range queries.

Hot spot

Ch 6

A partition (or key) receiving a disproportionate share of the load.

Key-range partitioning

Ch 6

Assigning each partition a contiguous, sorted range of keys — efficient range scans, risk of hot spots.

Local (document-partitioned) index

Ch 6

A secondary index where each partition indexes only its own records; reads must scatter/gather.

Partition (shard)

Ch 6

A subset of the data; each record belongs to exactly one partition.

Rebalancing

Ch 6

Moving partitions between nodes as data, load or the set of nodes changes.

Request routing

Ch 6

Deciding which node should handle a request, via any node, a routing tier or a partition-aware client.

Scatter/gather

Ch 6

Sending a query to every partition and combining the results; latency is set by the slowest partition.

Skew

Ch 6

Uneven distribution of data or load, so some partitions do much more work than others.

ACID

Ch 7

Atomicity, Consistency, Isolation, Durability — the safety guarantees transactions aim to provide.

Atomicity

Ch 7

If a transaction fails partway, all its writes are undone — abortability, not concurrency.

Dirty read

Ch 7

Seeing another transaction's uncommitted writes.

Lost update

Ch 7

Two concurrent read-modify-write cycles where one overwrites the other's change.

MVCC

Ch 7

Multi-version concurrency control: keeping several committed versions of each row to implement snapshots.

Phantom

Ch 7

A write in one transaction that changes the result of a search query in another.

Read committed

Ch 7

Isolation level preventing dirty reads and dirty writes; the default in many databases.

Read skew

Ch 7

Seeing different parts of the database at different points in time within one transaction (nonrepeatable read).

Serializable

Ch 7

The strongest isolation level: the outcome equals running the transactions one at a time, in some order.

Snapshot isolation

Ch 7

Each transaction reads from a consistent snapshot of the database as of its start.

SSI

Ch 7

Serializable snapshot isolation: optimistic — run on snapshots and abort at commit if a premise read has changed.

Transaction

Ch 7

A group of reads and writes executed as one unit that either commits entirely or aborts entirely.

Two-phase locking (2PL)

Ch 7

Pessimistic serializability: shared and exclusive locks held until commit, so readers and writers block each other.

Write skew

Ch 7

Two transactions read the same data, then update different rows based on a premise the other invalidated.

Asynchronous network

Ch 8

A network with no upper bound on message delay; messages can be lost, delayed or duplicated.

Byzantine fault

Ch 8

A node behaving arbitrarily or maliciously — sending corrupted or false messages.

Clock skew

Ch 8

The difference between the clocks of two machines at the same instant.

Fencing token

Ch 8

A monotonically increasing number issued with each lease so storage can reject writes from stale holders.

Lease

Ch 8

A lock with a timeout: the holder owns a resource until the lease expires, unless it renews it.

Monotonic clock

Ch 8

A clock that only moves forward; suitable for measuring durations, not for comparing across machines.

Network partition

Ch 8

A network fault that cuts some nodes off from others while each group keeps running.

Partial failure

Ch 8

Some parts of a distributed system fail while others keep working, often nondeterministically.

Process pause

Ch 8

A thread stopping unexpectedly — GC, VM suspension, swapping — without realizing time passed.

Safety vs liveness

Ch 8

Safety: nothing bad ever happens. Liveness: something good eventually happens.

System model

Ch 8

A formal set of assumptions about timing (synchronous, partially synchronous, asynchronous) and node failures.

Time-of-day clock

Ch 8

A wall clock returning time since the epoch; synced by NTP and able to jump backward.

Timeout

Ch 8

Giving up on a response after a fixed time — the only practical fault detector, unable to tell slow from dead.

Unbounded delay

Ch 8

The property of packet-switched networks that queueing can make a message arbitrarily late.

CAP theorem

Ch 9

During a network partition a system must choose between linearizability and availability.

Causal consistency

Ch 9

Operations that are causally related are seen in the same order by everyone; concurrent ones may differ.

Compare-and-set (CAS)

Ch 9

Atomically set a value only if it currently equals an expected value; a building block for locks and uniqueness.

Consensus

Ch 9

Getting nodes to agree on a value with agreement, integrity, validity and termination despite failures.

Epoch number

Ch 9

A monotonically increasing term/ballot number identifying a leader's reign in consensus algorithms.

In-doubt transaction

Ch 9

A 2PC participant that voted yes but hasn't heard the decision, so it holds locks and waits.

Lamport timestamp

Ch 9

A (counter, nodeID) pair where nodes bump their counter past any value they see, giving a total order consistent with causality.

Linearizability

Ch 9

Makes a replicated system appear to have a single copy of the data, with each operation taking effect atomically at one instant.

Total order broadcast

Ch 9

A protocol that delivers messages reliably and in the same order to all nodes; equivalent to consensus.

Two-phase commit (2PC)

Ch 9

An atomic commit protocol: a coordinator asks participants to prepare, then tells all to commit or abort.

XA transactions

Ch 9

A standard API for two-phase commit across heterogeneous databases and message brokers.

ZooKeeper / etcd

Ch 9

Coordination services offering linearizable, totally ordered storage for locks, leader election and membership.

Batch processing

Ch 10

Running a job over a large, bounded input to produce derived output, measured by throughput.

Broadcast hash join

Ch 10

A map-side join that loads a small input into an in-memory hash table on every mapper.

Data lake

Ch 10

Storing raw data in its original form first and deciding how to interpret it later.

Dataflow engine

Ch 10

Systems like Spark, Tez and Flink that run a whole workflow as a graph of operators, pipelining data between them.

HDFS

Ch 10

Hadoop Distributed File System: a shared-nothing filesystem that splits files into replicated blocks across machines.

Hot key (skew)

Ch 10

A key with disproportionately many records, overloading the single task that processes it.

MapReduce

Ch 10

A programming model: mappers emit key-value pairs, the framework sorts and shuffles by key, reducers combine each key's values.

NameNode

Ch 10

HDFS's central server that tracks which machines store which file blocks.

Pregel (BSP)

Ch 10

A graph-processing model where vertices exchange messages along edges in synchronous supersteps.

Shuffle

Ch 10

Partitioning, sorting and copying mapper output so each reducer receives all values for its keys.

Sort-merge join

Ch 10

A reduce-side join where both inputs are keyed by the join key so matching records meet in the same reducer.

Unix philosophy

Ch 10

Small programs that do one thing well, connected through a uniform text-stream interface.

Workflow scheduler

Ch 10

A tool (Airflow, Oozie, Luigi) that runs chains of dependent batch jobs.

Backpressure

Ch 11

Slowing down a producer when consumers can't keep up, instead of dropping or buffering without bound.

Change data capture (CDC)

Ch 11

Capturing every change written to a database and publishing it as a stream for other systems.

Consumer lag

Ch 11

How far a consumer's offset is behind the head of the log.

Consumer offset

Ch 11

The position in a log partition up to which a consumer has processed messages.

Event

Ch 11

A small, immutable record of something that happened at a point in time.

Event sourcing

Ch 11

Storing all application state changes as immutable domain events and deriving current state from them.

Event time vs processing time

Ch 11

When an event actually occurred versus when a processor handles it.

Exactly-once semantics

Ch 11

Results are as if each event were processed once, despite failures and retries.

Log compaction

Ch 11

Discarding older log entries for a key, keeping only the latest value, so the log stays bounded.

Log-based broker

Ch 11

A broker like Kafka that stores messages in an append-only, partitioned log consumers read by offset.

Straggler

Ch 11

An event that arrives after its window was considered complete.

Stream-table join

Ch 11

Enriching each event with data from a table kept current locally via change data capture.

Tumbling / hopping / sliding / session window

Ch 11

Ways to group events in time: fixed non-overlapping, fixed overlapping, relative-interval, and activity-based.

Auditing

Ch 12

Continuously checking data integrity, e.g. by re-deriving views or using cryptographic hashes.

Compensating transaction

Ch 12

A later action that corrects an earlier one, such as a refund or an apology for overbooking.

Derived data

Ch 12

Data created by transforming other data — caches, indexes, views — that can be rebuilt from the source.

End-to-end argument

Ch 12

A guarantee like duplicate suppression can only be fully provided with the help of the endpoints of the whole path.

Federated database

Ch 12

A unified query interface over many underlying stores (unifies reads).

Idempotence

Ch 12

An operation that has the same effect whether it runs once or many times.

Lambda architecture

Ch 12

Running a batch layer and a stream layer side by side and merging their outputs.

Request ID

Ch 12

A unique identifier generated by the client so a retried request can be recognised and applied only once.

System of record

Ch 12

The authoritative source of truth for some data; other representations are derived from it.

Timeliness vs integrity

Ch 12

Seeing up-to-date state (temporary if violated) versus having no corrupted or lost data (permanent if violated).

Unbundling the database

Ch 12

Composing specialised storage and processing tools around a log instead of relying on one monolithic database.

Write path / read path

Ch 12

Work done eagerly when data is written versus lazily when it is requested.