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
A database earns trust by defending three contracts under pressure: acknowledged changes remain recoverable, concurrent state stays coherent, and declarative questions preserve their meaning as execution routes change.
Promises And Server Shape
PostgreSQL presents one database through many backend processes: each connection owns private working memory, while backends and background processes coordinate through shared memory and durable files.
Promises And Server Shape
A PostgreSQL connection is a state machine: startup establishes identity, normal messages advance explicit query and transaction states, and errors, cancellation, and termination each have defined recovery consequences.
SQL Meaning Pipeline
SQL fixes the desired relation while leaving PostgreSQL free to choose its execution order, provided every transformation preserves duplicates, null semantics, types, and observable ordering.
SQL Meaning Pipeline
Raw parsing establishes grammatical structure, not database meaning: tokens and precedence become a faithful tree while object identity, types, operators, and privileges remain unresolved.
SQL Meaning Pipeline
Binding freezes SQL meaning for a statement: visible names become catalog identities, expressions receive concrete types and operators, and privileges are checked before strategy begins.
Planning And Execution
Logical planning may rearrange an analyzed query only across proven semantic equivalences; predicates, joins, projections, and subqueries are opportunities until SQL or security boundaries make their order observable.
Planning And Execution
Physical planning is a decision under uncertainty: PostgreSQL prices semantically valid paths from estimated cardinalities, so correct results are guaranteed while good performance depends on statistical evidence.
Planning And Execution
Execution is demand-driven composition: plan nodes share a lifecycle and tuple interface, allowing streaming pipelines, blocking operators, visibility checks, and cleanup to cooperate without exposing their internals.
Storage And Durability
Heap storage gives each physical tuple version a page-and-item address; line pointers keep that address stable within a page, while logical row identity and version lifetime remain separate concerns.
Storage And Durability
Shared buffers maintain one coherent in-memory identity per cached page: pins protect frame lifetime, short synchronization protects contents, and the WAL rule constrains when dirty pages may cross to disk.
Storage And Durability
WAL decouples commit from data-page placement through two orderings: durable commit waits for required log records, and a dirty page may reach disk only after WAL that explains its state.
Storage And Durability
Transactions make many physical traces carry one outcome: tuple metadata and transaction status determine whether work is committed or aborted, while WAL and later cleanup operate on separate schedules.
Concurrency And History
MVCC preserves a snapshot invariant: each reader combines tuple-version metadata with transaction outcomes to see one coherent past, while writers create future versions and vacuum later reclaims unreachable history.
Concurrency And History
Coordination primitives must match resource and lifetime: heavyweight locks defend logical claims, while LWLocks, spinlocks, and buffer content locks protect shared internals only for short critical sections.
Concurrency And History
A B-tree preserves ordered routes from keys to physical tuple candidates; it can narrow work or supply order, but heap and transaction state remain authoritative for MVCC visibility.
Concurrency And History
Index maintenance must never omit a candidate for a visible tuple; PostgreSQL may retain obsolete candidates for MVCC rechecks, use HOT chains when keys stay fixed, and remove dead routes later.
Concurrency And History
Vacuum reclaims history only after a visibility-horizon proof shows no relevant snapshot can need it, then reconciles heap space, index routes, visibility metadata, and transaction-ID age.
Recovery Metadata And Extensibility
A checkpoint bounds where redo must begin; recovery then compares ordered WAL with each page's state, reapplies missing effects, and restores committed history without treating the checkpoint as the commit guarantee.
Recovery Metadata And Extensibility
PostgreSQL describes itself with transactional catalog relations: stable identities and dependencies preserve structural meaning, while locks, visibility, caching, and invalidation make live DDL coherent.
Recovery Metadata And Extensibility
PostgreSQL extensibility is a metadata contract: implementations join typed catalog interfaces, while declared semantic properties constrain every optimization and storage structure that trusts them.
Scale And Distributed Shape
Isolation levels define which concurrent histories applications may observe; PostgreSQL strengthens the contract from statement snapshots to stable snapshots to serializable histories enforced through possible abort and retry.
Scale And Distributed Shape
Streaming replication exports ordered history, but receipt, write, durable flush, and replay are distinct progress claims; availability, commit safety, and read freshness depend on which position the contract names.
Scale And Distributed Shape
Partitioning preserves one logical relation by proving which local children can contain a read and routing each write to one bound; indexing, replication, and sharding solve different problems.
Architecture Synthesis
PostgreSQL is a chain of handoff invariants: session context becomes bound meaning, equivalent plans become visible tuple work, and ordered physical changes become recoverable committed history.
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.