The Computing Series

Real Systems

Redis is a hash map with O(1) GET and SET operations, plus sorted sets (a skip list, O(log N) per operation) and lists (a doubly-linked list). When an engineer says “Redis is slow for range queries,” they are observing that Redis uses a skip list for sorted sets (O(log N) per operation, O(N) for a full range scan) rather than a B-tree (also O(log N) per operation, but with much better cache behaviour for sequential scans). The algorithm explains the observation.

Elasticsearch builds an inverted index: for each term in the corpus, a sorted list of document IDs that contain that term. A full-text search query is an intersection of sorted lists — an O(N) merge that benefits from sorted order. The latency of Elasticsearch searches scales with the number of matching documents, not the total corpus size. This is the inverted index at work.

Git represents history as a DAG of commits. git log is a graph traversal. git merge is finding the lowest common ancestor (LCA) in that DAG — an O(depth) operation. When a repository has been running for ten years with hundreds of branches, merge operations touch more of the graph. The algorithm explains why merge latency correlates with repository age.


Concept: Reading Systems as Algorithms (the four-step method)

Thread: T12 (Tradeoffs) — every system is an optimisation decision; naming the algorithm makes that decision visible

Core Idea: Every production system has an algorithmic core: find the bottleneck operation, identify the data structure, identify the algorithm, name the complexity. The complexity class tells you how the system scales. A system you cannot name algorithmically is a system you cannot predict.

Tradeoff: AT4 — Precomputation vs. On-Demand (systems choose when to do algorithmic work; the algorithm type determines the cost of each choice)

Failure Mode: FM11 — Observability Blindness (you cannot find the bottleneck without metrics; the method requires measurement before analysis)

Signal: When a system shows unexpected latency growth at scale, or when a performance problem cannot be reproduced at small load — apply the four-step method. The complexity class will tell you at what scale the problem must appear.

Maps to: Reference Book, Framework 4 (Architecture Tradeoffs), Framework 3 (Failure Modes)


Read in the book →