Single-node Core
Single-Node Key-Value Core
Build GET, SET, and DEL around one in-memory dictionary while defining clear command, reply, and missing-key semantics.
Learning library
Single-node Core
Build GET, SET, and DEL around one in-memory dictionary while defining clear command, reply, and missing-key semantics.
Network Protocol
Parse incremental RESP frames safely across partial reads, nested values, and malformed input before dispatching commands.
Network Protocol
Trace each client from accept through buffered reads, command execution, queued replies, and connection teardown.
Execution Core
Multiplex file readiness and timer work in one event loop while keeping handlers short enough to preserve responsiveness.
Execution Core
Drive validation, authorization, and execution from command metadata instead of hard-coding a separate request path for every command.
Data Model
Separate logical value types from physical encodings so representation can change without changing command semantics.
Data Model
Spread hash-table resizing across ordinary operations so rehashing avoids a single latency spike while lookups consult both tables.
Memory Lifecycle
Combine lazy expiration on access with sampled active cleanup so expired keys disappear without blocking the server.
Memory Lifecycle
Enforce maxmemory by selecting victims under an explicit eviction policy whose trade-offs match the workload.
Data Model
Choose encodings and operations for lists, hashes, sets, and sorted sets according to their access patterns and size.
Command Behavior
Pipeline requests to reduce round trips while bounding per-client output buffers so slow consumers cannot exhaust memory.
Command Behavior
Queue commands between MULTI and EXEC, and use WATCH to abort optimistic transactions when observed keys change.
Command Behavior
Execute server-side scripts atomically by blocking interleaving, while controlling runtime so one script cannot stall every client.
Command Behavior
Fan published messages out to channel and pattern subscribers while accepting Pub/Sub's transient, at-most-once delivery semantics.
Command Behavior
Use ordered stream IDs, pending-entry tracking, acknowledgements, and claiming to divide durable work among consumers.
Persistence
Create point-in-time snapshots with fork and copy-on-write, balancing compact recovery files against snapshot cost and possible data loss.
Persistence
Use an append-only command log plus background rewrite to trade recovery fidelity against write amplification and file growth.
Persistence
Restore persisted state by loading an RDB snapshot or replaying AOF commands before accepting client traffic.
Replication And Failover
Bootstrap a replica from a consistent snapshot, then stream buffered writes so it catches up without losing changes made during transfer.
Replication And Failover
Resume replication from IDs, offsets, and a bounded backlog when history is available, falling back to full synchronization when it is not.
Replication And Failover
Use independent monitors, quorum, and epochs to promote one replica without letting competing observers create split-brain.
Clustering
Partition keys into hash slots and use MOVED redirects so clients can discover which node owns each key.
Clustering
Move hash slots live with migrating and importing states, ASK redirects, and dual-node coordination that preserves availability.
Capstone
Integrate protocol parsing, event handling, data structures, persistence, replication, and clustering into one coherent Redis-like system.
Promises And Server Shape
Consider the worst possible moment for a system to improvise. Money has moved, two users press save at once, the power flickers, and a report asks a question nobody imagined whe...
Promises And Server Shape
From the application side, there is only "the database": one host, one port, one name in a connection string. Inside, it is a society with rules. Client work happens in backend ...
Promises And Server Shape
Before a single query can mean anything, a connection has to become a session. An application opens a network connection and wants to talk in SQL, but the server cannot immediat...
SQL Meaning Pipeline
SQL is often introduced as a convenient way to get rows out of tables. That description is practical but too small. SQL is powerful because it lets users describe a relation the...
SQL Meaning Pipeline
SQL enters the database as text, which is easy for people to write but unusable for an executor. The string contains spaces, keywords, identifiers, operators, literals, comments...
SQL Meaning Pipeline
After parsing, a SQL statement has shape but not yet meaning. The tree may say that a query selects `balance` from `accounts`, compares it to a literal, and orders by `created_a...
Planning And Execution
An analyzed query knows what every name and expression means, but it still resembles the user's sentence. Planning begins by moving from sentence shape to relational structure. ...
Planning And Execution
Query planning matters because equivalent plans are not equally fast. Two plans can produce the same rows and still differ by seconds, by minutes, or by an outage. A Postgre-lik...
Planning And Execution
A plan is a promise about how to produce rows. The executor is the machinery that keeps that promise. It opens plan nodes, asks them for tuples, passes those tuples upward, and ...
Storage And Durability
The executor thinks in tuples, but disks and memory move in pages. Heap storage is the layer that turns table rows into bytes arranged inside fixed-size blocks. This is where a ...
Storage And Durability
Heap pages live on disk, but a database that touched disk for every row would be unusable. The buffer pool is the shared memory region that holds copies of disk pages while back...
Storage And Durability
Durability sounds simple from the outside. After commit, the data should not vanish. The straightforward way to deliver that is too slow inside a database. Writing every changed...
Storage And Durability
A transaction lets users treat several actions as one change. You transfer money by debiting one account and crediting another. You create an order, reserve inventory, and recor...
Concurrency And History
Multi-version concurrency control starts from a practical goal: readers should not have to stop the world to get a stable answer. Instead of overwriting rows in place and forcin...
Concurrency And History
MVCC lets readers and writers avoid many direct conflicts, but a database still needs coordination everywhere. A table cannot be dropped while another session scans it. Two proc...
Concurrency And History
An index lets the database find candidate rows without reading the whole table. It is not a second copy of the table in a prettier format. It is a maintained access path, tuned ...
Concurrency And History
Indexes answer reads quickly, but they cost something on every write. Each insert, update, and delete must keep every relevant index consistent with the heap's versioned reality...
Concurrency And History
MVCC lets the database keep old tuple versions so readers can see a stable past. Vacuum is the process that decides when the past can be physically removed. Without vacuum, ever...
Recovery Metadata And Extensibility
A database crash is not exceptional in the design. It is expected. Power can fail after WAL reaches disk but before data pages do. The operating system can stop the process whil...
Recovery Metadata And Extensibility
A relational database holds more than data. It also holds descriptions of that data. Tables have columns, columns have types, indexes belong to tables, functions accept argument...
Recovery Metadata And Extensibility
A database becomes much more powerful when its behavior is not sealed at compile time. Postgre-like systems treat functions, operators, types, casts, aggregates, and index suppo...
Scale And Distributed Shape
Transactions make changes feel atomic, but isolation decides how transactions overlap. This is where databases stop being simple state machines and start managing concurrent tim...
Scale And Distributed Shape
Replication begins with a practical concern. A database should not be a single fragile point. A standby can take over after failure, serve read traffic, back up data, or feed do...
Scale And Distributed Shape
Partitioning starts with a table that has grown too large or too busy to manage as one physical object, or that divides naturally along some boundary. To the user the logical re...
Architecture Synthesis
By now the database no longer looks like a black box behind a port. It looks like a layered machine that turns statements into durable, queryable state. Each layer has a narrow ...
Orientation
Model ride hailing as a two-sided, real-time marketplace whose core loop is request, quote, match, trip, payment, and feedback.
Orientation
Translate demand, latency, availability, durability, RPO, and RTO into numeric constraints that architecture decisions can be tested against.
Three Nines — 99.9%
Separate edge, identity, marketplace, trip, payment, communication, and data-platform responsibilities around a small set of authoritative state flows.
Three Nines — 99.9%
Separate authentication, rider and driver profiles, document verification, and account state so onboarding checks do not leak into every service.
Three Nines — 99.9%
Combine map data, routing, traffic signals, and continuous ETA correction while isolating uncertain predictions from trip truth.
Three Nines — 99.9%
Ingest high-rate, ephemeral driver updates with freshness rules and spatial indexing so nearby-driver views remain useful without pretending every point is durable truth.
Three Nines — 99.9%
Produce expiring price quotes from supply and demand, using surge to balance the market without rewriting an accepted trip's price.
Three Nines — 99.9%
Rank feasible driver–rider pairs under location, ETA, and marketplace constraints while keeping dispatch decisions explicit and auditable.
Three Nines — 99.9%
Make the trip state machine the source of truth, enforcing legal transitions and idempotent commands across request, match, pickup, and completion.
Three Nines — 99.9%
Record money movement in an immutable double-entry ledger while isolating processor retries, reconciliation, and driver payouts from trip state.
Three Nines — 99.9%
Treat push, chat, and masked calling as asynchronous, privacy-preserving channels that support a trip without becoming its source of truth.
Three Nines — 99.9%
Build read models and privileged workflows around immutable trip history so support actions are auditable and operational tools stay off the hot path.
Three Nines — 99.9%
Start with one region spread across three zones, using stateless services and zonally redundant data to survive a single-zone failure.
Three Nines — 99.9%
Instrument latency, traffic, errors, and saturation, then connect actionable alerts to an on-call response loop.
Three Nines — 99.9%
Move operational events into an analytical pipeline so reporting workloads cannot destabilize the transactional ride path.
Three Nines — 99.9%
Recognize that a three-nines baseline tolerates hours of annual disruption and still fails under zonal loss, overload, and fragile dependencies.
Four Nines — 99.99%
Give user journeys explicit SLOs and criticality tiers so scarce reliability investment follows impact and remaining error budget.
Four Nines — 99.99%
Remove hidden single points of failure by adding zonal redundancy, independent dependencies, health-aware routing, and bounded failover.
Four Nines — 99.99%
Shard state by stable ownership keys and automate fenced failover so growth and replica loss do not require unsafe manual intervention.
Four Nines — 99.99%
Publish state changes through a transactional outbox and make consumers idempotent so events can be retried and replayed safely.
Four Nines — 99.99%
Partition dispatch by geography, manage boundary spillover, and keep candidate search local enough to scale without missing viable drivers.
Four Nines — 99.99%
Combine deadlines, bounded retries, circuit breakers, load shedding, and graceful degradation so dependency trouble does not cascade.
Four Nines — 99.99%
Replicate critical state to a passive region and define detection, fencing, traffic shift, RPO, and RTO for a controlled regional failover.
Four Nines — 99.99%
Reduce deployment risk with canaries, feature flags, backward-compatible schemas, and migrations that can be paused or reversed.
Four Nines — 99.99%
Turn user-facing SLIs into SLOs and error budgets that govern alerting, reliability work, and release pace.
Four Nines — 99.99%
Stream immutable operational events into replayable processing so real-time metrics and features do not couple analytics to production databases.
Four Nines — 99.99%
Layer identity, authorization, encryption, audit trails, and risk signals around sensitive ride and payment flows without overloading the hot path.
Four Nines — 99.99%
Validate that every critical ride path has zonal redundancy, bounded failover, overload protection, observability, and safe-change controls.
Five Nines — 99.999%
Apply five nines only to safety- and trip-critical paths, allowing less critical analytics and convenience features to fail more cheaply.
Five Nines — 99.999%
Assign each trip and user a regional home while serving traffic from multiple regions, avoiding cross-region write conflicts during normal operation.
Five Nines — 99.999%
Group compute and data into repeatable cells so a hot market or failed dependency affects only its assigned riders and drivers.
Five Nines — 99.999%
Use quorum-backed storage for authoritative state and disposable fast stores for location and presence, matching consistency cost to data semantics.
Five Nines — 99.999%
Precompute and cache routing and ownership decisions so existing rides continue when control-plane services are unavailable.
Five Nines — 99.999%
Make mobile clients retry safely, cache useful state, and communicate degraded service because intermittent networks are part of the system.
Five Nines — 99.999%
Use hypothesis-driven failure injection and gamedays to prove that detection, degradation, and recovery work under realistic conditions.
Five Nines — 99.999%
Combine synthetic probes, client telemetry, and guarded automation to detect failures invisible to server metrics and remediate known cases safely.
Five Nines — 99.999%
Treat additional availability as an ongoing staffing and complexity cost, supported by ownership, runbooks, incident learning, and capacity discipline.
Five Nines — 99.999%
Assemble cells, regional homes, durable event flows, layered state, observability, and safe operations into one selectively five-nines ride exchange.
Orientation
Understand an exchange as an ordered market that accepts constrained orders, discovers prices, publishes trades, and hands obligations downstream.
Orientation
Map functional flows, scale, latency, consistency, availability, and recovery requirements before committing to component boundaries.
Orientation
Convert availability percentages into concrete downtime and failed-request budgets before choosing an architecture.
Three Nines — 99.9%
Decompose an exchange into order entry, risk, matching, market data, and post-trade boundaries connected by explicit event flows.
Three Nines — 99.9%
Trace an order through validation, risk, sequencing, matching, acknowledgement, market data, and post-trade processing.
Three Nines — 99.9%
Represent bids and asks so the matcher always selects the best price first and preserves arrival order within each price level.
Three Nines — 99.9%
Encode accepted, active, partially filled, filled, canceled, and rejected transitions so retries cannot produce impossible order states.
Three Nines — 99.9%
Translate order types and time-in-force rules into explicit matching constraints so execution behavior is deterministic and testable.
Three Nines — 99.9%
Use auctions, volatility controls, and trading halts to restore orderly price discovery when continuous matching becomes unsafe.
Three Nines — 99.9%
Make every matching decision a deterministic function of an ordered event log so replicas can replay and recover identical state.
Three Nines — 99.9%
Publish sequenced snapshots and incremental updates through a fanout path that lets consumers detect gaps and rebuild state.
Three Nines — 99.9%
Keep matching fast and safe by checking balances, positions, limits, and custody constraints before an order reaches the book.
Three Nines — 99.9%
Separate execution from clearing and settlement, carrying immutable trades into obligations, netting, and final asset transfer.
Three Nines — 99.9%
Scale participants by partitioning session and market-data fanout while preserving a narrow, deterministically ordered matching core.
Three Nines — 99.9%
Achieve a credible three-nines baseline by persisting ordered events and rebuilding deterministic state after process crashes.
Four Nines — 99.99%
Audit every critical request path for single points of failure, including hidden dependencies shared across otherwise redundant components.
Four Nines — 99.99%
Replicate an ordered input log to a hot standby so deterministic replay produces a ready-to-promote copy of matching state.
Four Nines — 99.99%
Sequence messages and repair detected gaps with NAKs, retransmission, and snapshots instead of pretending packet delivery is perfect.
Four Nines — 99.99%
Decouple durable session identity and sequence state from individual gateways so clients can reconnect without duplicating or losing orders.
Four Nines — 99.99%
Deploy compatible, reversible changes with canaries, dual-version protocols, and staged migrations so trading continues during upgrades.
Four Nines — 99.99%
Combine failure detection, quorum-backed leases, fencing, and epochs so only one matching leader can accept orders.
Four Nines — 99.99%
Protect order entry and matching with admission control and load shedding, degrading noncritical work before queues collapse.
Four Nines — 99.99%
Reach four nines by spreading critical components across zones, removing shared failure domains, and automating bounded failover.
Four Nines — 99.99%
Assemble multi-zone redundancy, automated failover, durable logs, and overload controls into a coherent four-nines exchange.
Five Nines — 99.999%
Reserve five-nines engineering for the trading paths whose failure causes the most harm, and give supporting systems cheaper targets.
Five Nines — 99.999%
Keep consensus out of per-order execution where possible, using it to establish ownership while a single leader orders the hot path.
Five Nines — 99.999%
Survive regional loss with preplanned traffic shifts, fenced ownership, replicated state, and explicit recovery-point trade-offs.
Five Nines — 99.999%
Partition the exchange into self-contained cells so overload or failure in one market segment cannot consume the whole platform.
Five Nines — 99.999%
Expose partial and ambiguous failures with targeted probes and chaos drills that verify detection, isolation, and recovery before production does.
Five Nines — 99.999%
Treat deployment as a failure mode and reduce its blast radius with staged rollout, compatibility, observability, and fast rollback.
Five Nines — 99.999%
Assemble cells, multi-region ownership, static stability, and disciplined operations into a five-nines design with bounded failure domains.
Five Nines — 99.999%
Connect order entry, risk, deterministic matching, market data, clearing, and recovery into one end-to-end exchange design.
The Fast Exchange — Milliseconds to Microseconds
Control latency variance across participants because unequal access time can distort price-time priority even when matching is correct.
The Fast Exchange — Milliseconds to Microseconds
Measure end-to-end latency with coordinated timestamps, percentiles, and realistic load so queues and tail behavior remain visible.
The Fast Exchange — Milliseconds to Microseconds
Reach millisecond latency by shortening synchronous paths, bounding queues, colocating dependencies, and eliminating avoidable network hops.
The Fast Exchange — Milliseconds to Microseconds
Reach microsecond latency by aligning data layout, CPU affinity, memory access, and network I/O with the hardware's actual costs.
The Fast Exchange — Milliseconds to Microseconds
Treat tail latency and jitter as first-class outcomes because unpredictable delay undermines both throughput and participant fairness.
The Fast Exchange — Milliseconds to Microseconds
Turn fairness into enforceable ordering rules, synchronized ingress, and auditable timestamps rather than relying on average latency.
The Fast Exchange — Milliseconds to Microseconds
Resolve reliability–latency conflicts by keeping the hot path minimal while moving replication and recovery work to carefully bounded boundaries.
Foundations
Learn What Problem Does Docker Solve? while evolving MiniDock, a complete container engine designed from first principles.
Foundations
Learn Containers vs. Virtual Machines while evolving MiniDock, a complete container engine designed from first principles.
Foundations
Learn The Layered Runtime Architecture while evolving MiniDock, a complete container engine designed from first principles.
Foundations
Learn Namespaces: The Walls while evolving MiniDock, a complete container engine designed from first principles.
Foundations
Learn Cgroups: The Meters while evolving MiniDock, a complete container engine designed from first principles.
Foundations
Learn The Security Sandwich while evolving MiniDock, a complete container engine designed from first principles.
Images
Learn Anatomy of an Image while evolving MiniDock, a complete container engine designed from first principles.
Images
Learn Content Addressing while evolving MiniDock, a complete container engine designed from first principles.
Images
Learn Union Filesystems while evolving MiniDock, a complete container engine designed from first principles.
Images
Learn Building Images while evolving MiniDock, a complete container engine designed from first principles.
Images
Learn The Build Cache while evolving MiniDock, a complete container engine designed from first principles.
Images
Learn Multi-Stage Builds while evolving MiniDock, a complete container engine designed from first principles.
Images
Learn The On-Disk Stores while evolving MiniDock, a complete container engine designed from first principles.
Distribution
Learn Registry Architecture while evolving MiniDock, a complete container engine designed from first principles.
Distribution
Learn Pull, End to End while evolving MiniDock, a complete container engine designed from first principles.
Distribution
Learn Push and Dedup while evolving MiniDock, a complete container engine designed from first principles.
Distribution
Learn Tags, References, and Garbage while evolving MiniDock, a complete container engine designed from first principles.
Runtime
Learn The Container Lifecycle while evolving MiniDock, a complete container engine designed from first principles.
Runtime
Learn docker run: The Full Picture while evolving MiniDock, a complete container engine designed from first principles.
Runtime
Learn Copy-on-Write at Runtime while evolving MiniDock, a complete container engine designed from first principles.
Runtime
Learn Supervision and Restart Policies while evolving MiniDock, a complete container engine designed from first principles.
Runtime
Learn exec, attach, and logs while evolving MiniDock, a complete container engine designed from first principles.
Runtime
Learn Stopping Gracefully while evolving MiniDock, a complete container engine designed from first principles.
Runtime
Learn Health Checks while evolving MiniDock, a complete container engine designed from first principles.
Storage
Learn Volumes, Binds, tmpfs while evolving MiniDock, a complete container engine designed from first principles.
Storage
Learn Volume Lifecycle and Drivers while evolving MiniDock, a complete container engine designed from first principles.
Storage
Learn Storage Drivers while evolving MiniDock, a complete container engine designed from first principles.
Networking
Learn The Container Network Model while evolving MiniDock, a complete container engine designed from first principles.
Networking
Learn Bridge Networking while evolving MiniDock, a complete container engine designed from first principles.
Networking
Learn Publishing Ports while evolving MiniDock, a complete container engine designed from first principles.
Networking
Learn DNS and Service Discovery while evolving MiniDock, a complete container engine designed from first principles.
Networking
Learn Host, None, and the Driver Seam while evolving MiniDock, a complete container engine designed from first principles.
Networking
Learn Overlay Networks while evolving MiniDock, a complete container engine designed from first principles.
Orchestration
Learn Compose: Declarative Applications while evolving MiniDock, a complete container engine designed from first principles.
Orchestration
Learn Dependency Ordering while evolving MiniDock, a complete container engine designed from first principles.
Orchestration
Learn Swarm Architecture while evolving MiniDock, a complete container engine designed from first principles.
Orchestration
Learn Services, Tasks, and Reconciliation while evolving MiniDock, a complete container engine designed from first principles.
Production & Capstone
Learn Events, Logs, and Metrics while evolving MiniDock, a complete container engine designed from first principles.
Production & Capstone
Learn Hardening MiniDock while evolving MiniDock, a complete container engine designed from first principles.
Production & Capstone
Learn track: The Full Map while evolving MiniDock, a complete container engine designed from first principles.