System Design Beyond the Basics in Rust
Glossary
175 terms from System Design Beyond the Basics in Rust, in plain words, each with the chapter that teaches it.
#
- 80/20 rule
- About 20% of the data (the hot data) gets about 80% of the reads. Kettle & Crane therefore caches only the hottest 20% of customer profiles instead of all of them.
A
- Ack (acknowledgement)
- A replica's confirmation that it stored a write. A quorum write waits for W of them.
- Active-active
- A multi-region setup where both regions serve traffic at once. It gives lower latency, but writes in two places can conflict.
- Active-passive
- A multi-region setup where one region serves and the other keeps copies and waits. It is simple, but it gives no latency gain and the idle region may fail when needed.
- Adaptive bitrate
- The video player measures its connection speed and fetches each next segment from the rendition that fits. A slow connection drops to 480p instead of stalling.
- Anycast
- A method that gives several regions one shared IP address and lets internet routing pick the nearest one. It is the alternative to geo DNS.
- API gateway
- One front door that checks every request, for example against rate limits, before the app sees it.
- API key
- A secret string that a café's software sends to identify itself to the wholesale API. It can serve as the rate-limit key.
- Assumption
- A guess you choose to work with and say out loud in an interview, such as "I'll assume 60,000 orders a day".
- Asynchronous replication
- The leader confirms a write at once and followers catch up later. It is fast, but a crash can lose the latest writes.
- At-least-once delivery
- The consumer commits after processing, so a crash causes the event to be delivered again. Consumers must therefore be idempotent.
- At-most-once
- The consumer commits before processing, so there are no duplicates, but a crash can skip an event for good. This suits view counts, never orders.
- Atomic increment
- One step that adds to a number and returns the new value, so two servers can't both read 4 and both write 5. Redis's INCR command does this.
B
- Bandwidth
- A network link's throughput, counted in bits per second; Mbps means millions of bits per second. Because a byte is 8 bits, 1 MB a second needs 8 Mbps.
- BinaryHeap
- A Rust collection that is a max-heap, used for top-k and priority work. Wrapping items in `Reverse` makes it a min-heap.
- Bit
- A single 0 or 1; a byte is 8 bits. Network speeds are counted in bits, storage in bytes.
- Blob
- A file's raw bytes, such as a product photo or a class video. Blobs live in object storage, not in the database.
- BM25
- The standard search ranking formula. It weighs rare words more, gives repeats diminishing returns, and discounts long texts.
- Bottleneck
- The one component that limits the whole system, as a bottle's neck limits how fast it pours. Deep dives focus on it.
- BTreeMap
- Rust's map (and set, `BTreeSet`) type that keeps its keys in sorted order. Iterating or printing it gives a stable, predictable order, unlike a `HashMap`.
C
- Cache
- A fast copy of frequently read data kept close to where it's needed. It saves slower trips to the database or across the network.
- Cache busting
- Putting the content hash in the file name, as in `mug-blue.3f9a1c.jpg`. A changed photo gets a new name, so the CDN can cache every name forever.
- cargo
- Rust's project and build tool. `cargo test` runs the tests, and `cargo run --release` builds and runs with optimizations.
- Cassandra and DynamoDB
- Widely used databases that partition data with hashed rings and offer both local and global secondary indexes.
- Causal consistency
- Effects never appear before their causes. If Priya replies to a review, nobody sees the reply without the review.
- CDN (content delivery network)
- A network of servers around the world that caches and serves files such as images and video segments near viewers. It makes heavy outgoing bandwidth cheap.
- Change data capture (CDC)
- Reading the database's own change log and publishing every change as an event. It's an alternative to the transactional outbox.
- Chunk
- One piece of a large file in a multipart upload, say 8 MB. A failed chunk can be resent on its own.
- Committed (Raft)
- In Raft, a change is committed once a majority of nodes store it, so it survives any later election.
- Committed offset
- The next offset a consumer group will read in a partition. After a restart the group carries on from there.
- Conflict
- Two writes to the same key happening at once in different places, as can happen with multi-leader or leaderless replication.
- Consensus
- Getting nodes to agree on one value, or one order of changes, even when some fail. Raft and Paxos solve it.
- Consistency model
- A promise about what a read may return from replicated data. Models range from strongest to weakest: linearizable, causal, read-your-writes, monotonic reads, and eventual.
- Consistent hashing
- Placing keys and shards on a hash ring so that adding a shard moves only its fair share of keys, instead of most keys as with `% n`.
- Constant-time comparison
- Comparing two values by checking every byte instead of stopping at the first difference. It takes the same time wherever they differ, so an attacker can't guess a signature by timing.
- Consumer group
- A named reader of a log with its own offset per partition. The shipping and email groups each read every event independently.
- Content hash
- A hash of a file's bytes, such as SHA-256. It checks integrity and lets identical files or chunks be stored once.
- Courier matching
- Assigning each same-day delivery order to the nearest courier. The hard parts are many location writes and "nearest" queries.
- CRC-32
- A stable hash function that turns text into a 32-bit number. It is used to choose a Kafka-style partition from an event key, since its answer for a given key never changes between runs or versions.
- Cross-region replication
- Each region copying its data to the other, for disaster recovery. It is asynchronous to avoid adding about 70 ms to every write.
D
- Data center
- A building full of servers. A region is a cloud provider's group of data centers in one area.
- Data residency
- Laws in some countries requiring their citizens' data to stay inside the country, so global shops need a region there.
- Deduplication
- Storing files or chunks that have the same hash only once.
- Deep dive
- A close look at one part of a design, such as how payments avoid double charges. You pick the part that holds the bottleneck.
- Dirty read
- Seeing another transaction's unfinished changes. The read committed isolation level prevents it.
- Distributed rate limiting
- Keeping one shared count per key across all servers, for example in Redis, so a customer can't multiply their limit by the server count. If the store is down, each server falls back to a looser local limit.
- DNS TTL
- The time DNS resolvers may keep an answer cached. Lower it, for example to 60 s, before failover drills so changes take effect quickly.
- Double-entry ledger
- A record where every movement of money is written as entries in two or more accounts that sum to zero, so money can't vanish. Mistakes get new entries, never edits.
E
- Egress
- Data leaving your network, which clouds charge for. It is the big cost in video streaming.
- Elasticsearch and OpenSearch
- Search engines that shard an inverted index by document and answer queries with scatter-gather.
- Erasure coding
- Splitting data into pieces plus extra computed pieces, so lost pieces can be rebuilt without keeping three full copies.
- etcd and ZooKeeper
- Tools that store small shared facts, such as who leads or which shards exist, using consensus. You rarely write consensus yourself.
- Event
- A record that something happened, such as an order placed. A log keeps events in arrival order.
- Event streaming
- Building systems around logs of events that many readers can read now or later. Apache Kafka is the best-known tool.
- Eventual consistency
- If writes stop, all copies end up the same. It is the weakest and cheapest model, fine for view counts.
- Exactly-once
- Each event's effect happens once. Kafka offers it inside Kafka with transactions, but a consumer that writes elsewhere must still be idempotent.
- Expiry
- A Unix timestamp (seconds since January 1, 1970) after which a signed URL stops working.
F
- Failover
- Switching to a healthy region when one fails. A failover drill turns a region off on purpose, at a quiet time, to measure the real RPO and RTO.
- Fair share
- The portion of keys a new shard should take, one fifth when a fifth shard joins. Consistent hashing moves about that many.
- Feed cache
- A cached list of a user's latest post IDs. With hybrid fan-out, posts from authors under a follower threshold are pushed into followers' lists, and bigger authors are pulled at read time.
- Fencing token
- A number that grows with each new leader, such as its term. Storage rejects writes with a lower token, so an old leader's writes bounce.
- Fixed window counter
- A limiter that counts requests per key per fixed time window, such as each minute. It is cheap but allows a window edge burst.
- FNV-1a
- A simple hash that XORs in each byte and then multiplies by a prime. It is stable and easy to write by hand, which makes it good for teaching and hash rings, but it is not a cryptographic hash and is not suitable for security.
- Follower
- A node that holds a copy of a leader's data and takes changes from it.
- FTS5
- A sqlite extension that keeps an inverted index in a virtual table. `MATCH` queries it and `bm25()` scores the results (negated, so lower is better).
- Full-text search
- Finding products that contain the typed words, best match first. SQL's LIKE can't do this at scale.
G
- Geo DNS
- DNS that answers the shop's host name with the address of the region nearest to where the request came from.
- Geohash
- A short text code per map cell. Rounding coordinates cuts the map into grid cells, so courier search checks the order's cell and its 8 neighbors.
- Global index
- A secondary index partitioned by the indexed value, so a query asks one place. A write touches two shards, and the index can lag.
H
- Hash ring
- A circle of hash values from 0 to 4,294,967,295. Each key belongs to the next shard point clockwise, wrapping around after the largest.
- HashMap
- Rust's hash-based map type (and `HashSet` for sets). It gives fast lookups but iterates in an unspecified, random order, so its output order shouldn't be relied on.
- Headroom
- Spare capacity for surprises. Plan servers at about 70% load, so a server that handles 300 requests a second counts as 210.
- Health check
- A regular test that a server or region is working. Regions that fail it are taken out of routing.
- HLS (HTTP Live Streaming)
- A common video format where each rendition is cut into short segments listed in a playlist.
- HMAC (hash-based message authentication code)
- A hash of a message mixed with a secret key. Anyone can read a signed URL, but only the secret's holder can make a matching signature.
- Home region
- The region that holds a customer's data and serves their writes, chosen from their shipping state. It keeps two regions from writing the same row.
- Hot key
- A single key that gets far more traffic than others, such as a famous café's feed. Even hashing doesn't spread it.
I
- Idempotent
- Safe to repeat: doing it twice has the same effect as once. Consumers and payment calls use order IDs so a retry doesn't ship or charge twice.
- idf (inverse document frequency)
- A weight that grows as fewer documents contain a word, so rare words like "chocolatey" count more than common ones like "espresso".
- Indexer
- A worker that updates the search index when product events arrive. A reindex job rebuilds the index to repair drift.
- Integrity
- Assurance that bytes arrived unchanged. It is checked by comparing the hash computed after upload with the one the browser sent.
- Inverted index
- A map from each word to the documents that contain it, like a book's index. Each word's set of documents is its posting set.
- Isolation level
- A setting that controls how much concurrent transactions in one database can see of each other's work. Common levels are read committed, snapshot isolation and serializable, trading speed for fewer surprises.
J
- Jitter
- A small random extra delay added to retries so clients don't all retry at the same moment.
K
- Kafka
- The best-known event streaming tool, which keeps events in partitioned logs. Kafka 4 runs on KRaft instead of ZooKeeper.
- Key salting
- Splitting a hot key into parts by adding a suffix like `#0` to `#3`. Writes pick a part at random, and reads fetch all parts.
- KRaft
- Kafka's own built-in Raft consensus, used in Kafka 4 instead of ZooKeeper.
L
- Last-write-wins (LWW)
- Resolving a conflict by keeping the later timestamp and dropping the other write. It can silently lose an edit.
- Latency
- How long one piece of work takes, such as a read or a network round trip. Throughput is the amount finished per second.
- Leader
- A node that accepts writes and copies them to its followers. Leader election is followers voting for a new leader by majority.
- Leaderless replication
- Any replica accepts writes. The client writes to several at once, and quorums decide what reads see.
- Leaky bucket
- A limiter cousin of the token bucket. Requests join a queue that drains at a steady rate, smoothing bursts instead of allowing them.
- Lifecycle rules
- Storage rules that move or delete objects by age, such as archiving after 90 days.
- LIKE
- SQL's pattern match, with `%` as a wildcard. `LIKE '%espresso%'` can't use an index, so it scans every row.
- Linearizable
- The system acts like one copy of the data: once a write is confirmed, every later read by anyone sees it. Stock and payments need it.
- Local index
- A secondary index where each shard indexes its own rows. Writes stay on one shard, but a query must ask every shard.
- Log
- An append-only list that keeps every event in arrival order, so many readers can read it now or later. A queue, by contrast, deletes a message once handled.
- Log replication
- In Raft, the leader adds each change to its log and sends it to followers. Once a majority store it, the change is committed.
- Lost update
- A write that vanishes with no error, such as Sam's note being dropped by last-write-wins.
- Lua script
- A script run inside Redis that makes a read-modify-write, such as a token bucket check, one atomic step.
M
- Majority
- More than half of all nodes. Two majorities of one cluster always share a node, so two leaders can't win the same term.
- Merge
- Combining conflicting versions instead of dropping one, for example taking the union of two carts.
- Metadata
- Facts about a file: name, size, owner, type and where it's stored. It lives in a database row that holds the object key.
- Millisecond
- A thousandth of a second. A microsecond is a millionth and a nanosecond a billionth.
- Monotonic reads
- A reader never sees older data after newer data. Once you've seen version 5, you never get version 4.
- Multi-leader replication
- Several leaders, usually one per region, accept writes and send them to each other. Writes stay local and fast, but two leaders can change one row at once.
- Multipart upload
- Sending a big file as chunks, possibly in parallel, each retried on its own. A resumable upload carries on from the last chunk that arrived.
N
- Network partition
- A failure that cuts some nodes off from others, so each side can't reach the rest. It can leave an old leader isolated and cause split brain.
- Non-repeatable read
- A row changing between two reads in the same transaction. Read committed allows it; snapshot isolation prevents it.
O
- Object key
- The name a file is stored under in object storage, such as `products/mug-blue/1.jpg`. Amazon S3 is the example object storage service.
- Offset
- An event's position in its partition, starting at 0. Consumers read from an offset and can replay from an old one.
P
- p99
- A latency target meaning 99 of 100 requests are faster than this value, for example p99 under 300 ms.
- partial_cmp
- The Rust comparison for f64, which can be NaN and so has no total order. `select_nth_unstable_by` uses it to move the best k items to the front without fully sorting.
- Partition (of a topic)
- One ordered list of events within a topic. More generally, partitioning or sharding splits data across machines, with a shard key choosing where each row goes.
- partition_point
- A Rust slice method doing binary search on a sorted list. It returns the index of the first item for which the test is false, and the hash ring uses it to find the next point.
- Paxos
- An older consensus algorithm that solves the same problem as Raft.
- Payment provider
- An outside service such as Stripe that holds card details, so they never touch Kettle & Crane's servers.
- Payment states
- The states of a payment: created, authorized (bank holds the money), captured (money taken, when the order ships) or failed. Captured and failed are final, and the payment state machine allows only certain moves between them.
- Peak factor
- The multiple of average traffic you plan for at peak. Peak RPS (requests per second) is the average times this factor.
Q
- Quorum
- A set of replicas big enough to decide: W acks to write and R answers to read. If W + R > N, a read always overlaps the latest write.
R
- Raft
- The common consensus algorithm, with leader election by majority, numbered terms and log replication.
- Ranking
- Putting the best search matches first by a relevance score, from simple term counts up to BM25.
- Rate limiter
- Something that caps how many requests one client may make in a period. It protects servers from bursts and shares capacity fairly.
- Read-your-writes
- You always see your own writes. "Saved" must look saved to you, such as after editing your profile.
- Rebalancing
- Moving data when shards change. It runs in the background: copy keys while the old shard still serves them, switch the ring, then delete the old copies.
- Reconciliation
- A nightly job comparing your ledger with the payment provider's report and flagging differences.
- Redis
- A fast in-memory store used for shared counts, caching and geo commands.
- Region
- A cloud provider's group of data centers in one area, such as us-west near Portland and us-east near Columbus.
- Rendition
- One quality level of a video, such as 1080p at 5,000 kbps or 480p at 1,000 kbps.
- Replay
- Reading a log again from an old offset. It works because events stay for the retention period whether or not anyone has read them.
- Replica
- A copy of data kept on another node, either to survive failures or to share read load.
- Replication lag
- How far behind a copy is from the original, usually hundreds of milliseconds across regions and sometimes seconds. The writes inside the lag are lost if the source dies.
- Retention
- How long a topic keeps events, say 7 days, whether or not they have been read. After that they are removed.
- Retry-After
- The HTTP header, sent with status 429 Too Many Requests, that tells a client how many seconds to wait before trying again.
- RPO (recovery point objective)
- How much recent data you may lose in a disaster, measured in time. Replication lagging up to 2 seconds means an RPO of about 2 seconds.
- RTO (recovery time objective)
- How long recovery may take. If detecting an outage takes 3 minutes and switching takes 10, the RTO is about 13 minutes.
- rustc
- The Rust compiler. `rustc -O name.rs` compiles one file with optimizations, and `rustc --test name.rs -o t` builds the tests.
S
- Scatter-gather
- Sending a query to every shard, taking each shard's top results and merging them. It is only as fast as the slowest shard.
- Secondary index
- An index for finding rows by something other than the shard key, such as orders for MUG-BLUE when orders are sharded by customer.
- Secrets manager
- A service where real secrets live, instead of in code. Servers load the secret from it, or from an environment variable.
- Segment
- A few seconds of video, such as 4 seconds, fetched as one file and listed in a playlist.
- Semi-synchronous replication
- The leader waits for just one follower before confirming a write.
- Serializable
- The strongest isolation level: transactions behave as if run one at a time. It prevents all the anomalies but is the slowest.
- Session guarantee
- A promise to one user's session rather than to everyone, such as read-your-writes. It is cheap: one version number per session.
- Shard key
- The field, such as customer ID, whose hash decides which shard a row lives on. Queries by anything else need a secondary index.
- Signed URL
- A storage link that works only as issued and until it expires, proved by a signature. It lets browsers upload straight to storage without passing through the app.
- Single-leader replication
- One leader per piece of data. Every write has one clear order, but if the leader dies a follower must take over.
- Sliding window log
- A limiter that stores each allowed request's time and counts only those in the last window. It is exact, but costs memory for one timestamp per request.
- Snapshot isolation
- An isolation level that prevents non-repeatable reads but still allows write skew.
- Source of truth
- The product database is the authoritative record; the search index is just a copy for fast reading.
- Split brain
- Two nodes both believing they lead, for example an old leader cut off by a network partition. Fencing tokens guard against it.
- Stable hash
- A hash function that gives the same number for the same input on every machine, run and language version. Rust's `DefaultHasher` doesn't promise this, so partitioning code uses hand-written hashes such as FNV-1a or CRC-32.
- State machine
- A list of allowed states and moves that refuses every other move. A late retry can't capture a failed payment.
- Stop words
- Very common words, such as "the", dropped from search because they don't help rank.
- Storage classes
- Storage tiers that trade price for speed: hot for product photos, cheaper cold or archive for old raw videos.
- Synchronous replication
- The leader waits for followers to have a write before confirming it. Nothing is lost if the leader dies, but every write waits for the slowest follower.
T
- Term
- A leader's numbered period in Raft. Each election starts a new, higher term, and a node that hears of a higher term steps down.
- Term frequency
- How often the query's words appear in a document. It is the simplest relevance score.
- Threshold
- The follower count, 10,000 here, below which a post is pushed into followers' lists and above which it is pulled at read time.
- Throughput
- How much work a system finishes per second. More highway lanes add throughput, but the drive takes just as long.
- Thumbnail
- A small copy of a photo, such as 200 or 800 px wide, made by a worker after upload.
- Token bucket
- A limiter where each key has a bucket of up to a capacity of tokens. Each request spends one, and tokens refill at a steady rate, so a quiet client saves up a burst.
- Tokenize
- Lowercasing text and splitting it into words (tokens) so they can go in an inverted index.
- Topic
- A named stream of events in Kafka, split into partitions that spread the load across brokers. Events in a topic, such as an `orders` topic keyed by customer ID, stay in order within each partition.
- Trade-off
- What you give up to get something. Seniors state it with: "We choose X because Y. The cost is Z."
- Transaction
- A group of database changes that succeed or fail together. Isolation levels say how much concurrent transactions see of each other.
- Transactional outbox
- Writing the order and its event row in one transaction, with a relay that publishes the row. It gets events into the log reliably.
- Transcoding
- Converting an uploaded video into several renditions cut into segments.
- Typeahead
- Suggesting names as the user types. A binary search on a sorted list finds where the typed prefix would go.
V
- Version
- A number that grows with each change, used to judge which copy of a value is newest.
- Version vector
- One counter per replica, used to tell a real conflict from one write simply following another.
- Virtual node (vnode)
- One of many points a shard gets on the hash ring, so the many small arcs average out for an even spread.
W
- Window edge burst
- The weakness of a fixed window counter: 5 requests at 0:59 and 5 at 1:00 all pass, giving 10 in one second.
- Wrap around
- On the hash ring, going past the largest point back to the start. In Rust, `wrapping_mul` similarly wraps on overflow instead of panicking.
- Write skew
- Two transactions each check a rule, then both write and break it together, such as two baristas both signing off when one must stay.