System Design Beyond the Basics in Java
Glossary
187 terms from System Design Beyond the Basics in Java, 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 that share of its 1,000,000 customer profiles.
A
- Acknowledgement (ack)
- A replica's confirmation that it stored a write. A quorum write waits for W acks before it counts as done.
- Active-active / active-passive
- In active-passive, one region serves customers while the other keeps copies and waits. In active-active, both regions serve traffic, which Kettle & Crane chooses.
- 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 way to route users to the nearest region by giving several regions the same IP address and letting internet routing choose. It is the alternative to geo DNS.
- API gateway
- A single front door that checks every request, for example against rate limits, before the app sees it.
- API key
- A secret string a client, such as a café's software, sends to identify itself. Kettle & Crane limits the wholesale API per key.
- Assertion (assert, java -ea)
- A Java statement that checks a condition, but only when the program runs with the `-ea` flag. A plain `check` helper always runs.
- Assumption
- A guess you choose to work with and say out loud in a design 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
- A consumer commits its offset after processing, so a crash causes the event to be delivered again. Consumers must therefore be idempotent.
- At-most-once
- A consumer commits before processing, so there are no duplicates, but a crash after the commit loses the event. It is fine for view counts, never for orders.
- Atomic increment
- One step that adds to a counter 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. Links are rated in Mbps, so 1 MB a second needs 8 Mbps.
- Bit
- A single 0 or 1. A byte is 8 bits.
- Blob
- A file's raw bytes, such as a product photo or a brewing-class video. Blobs live in object storage while facts about them live in the database.
- BM25
- The standard search ranking formula. Rare words count more than common ones, and long texts count a little less.
- Bottleneck
- The one component that limits the whole system, as a bottle's neck limits how fast it pours. Deep dives focus on it.
- Broker
- A Kafka server that stores partitions. Spreading partitions across brokers spreads the load.
C
- Cache busting
- Putting the content hash in a file name, as in `mug-blue.3f9a1c.jpg`. A changed file gets a new name, so the CDN can cache every name forever without serving old versions.
- Capacity / refill rate
- In a token bucket, capacity is the most tokens it holds, which is the largest burst. The refill rate is how fast tokens come back.
- Cassandra / DynamoDB
- Widely used databases that partition data with hashed rings and offer local and global secondary indexes.
- Causal consistency
- Effects never appear before their causes. Nobody sees Priya's reply to a review without the review.
- CDN (content delivery network)
- A network of servers near users that caches and serves files such as images and video segments. Kettle & Crane serves media through `cdn.kettleandcrane.com`.
- Change data capture (CDC)
- Reading a database's own change log and publishing every change as an event. It is another way to feed an event log reliably.
- Checked exception
- A Java error type that a method must either handle or declare with `throws`. Several crypto calls throw them, so the examples declare `throws Exception`.
- Chunk
- One piece, such as 8 MB, of a large file in a multipart upload. A failed chunk is resent on its own.
- Clockwise
- On the hash ring, the direction toward larger hash numbers. A key belongs to the first shard point reached going clockwise.
- 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 event a consumer group will read in a partition. It lets a group restart where it left off.
- Conflict
- Two writes to the same key happening at once in different places, as can occur 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 do this.
- Consistency model
- A promise about what a read may return. They run from linearizable down to eventual, and each feature picks the one it needs.
- Consistent hashing
- Placing keys and nodes on a hash ring so that adding a shard moves only a small share of keys. With `% n`, most keys move.
- Constant-time comparison
- Comparing two values in the same time whether the first or last byte differs. This stops an attacker guessing a signature by timing the answers.
- 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 that bytes arrived unchanged and lets identical files or chunks be stored once.
- CRC32
- A fast, stable hash function. It picks a partition from an event's key in the Kafka model and was used for `% n` sharding in the earlier book.
D
- Data center
- A building full of servers. A region is a 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.
- Dedup (deduplication)
- Storing files or chunks with the same content hash only once. Chunks 1 and 2 of the 20 MB test video are identical, so they are stored once.
- Deep dive
- A close look at one hard part of a design, such as how payments avoid double charges. Interviews give it 10 of the 45 minutes.
- Direct upload
- The browser sends file bytes straight to storage using a signed URL, so the app handles only small requests.
- Dirty read
- Seeing another transaction's unfinished changes. Read committed isolation prevents it.
- Distributed rate limiting
- Keeping one shared count per key in a fast store such as Redis, so a customer's limit doesn't multiply with the number of app servers.
- Double-entry ledger
- A record of money in which each movement is written as entries in two or more accounts that add up to zero. Mistakes are fixed with new entries, never by editing old ones.
E
- Egress
- Data leaving your network, which cloud providers charge for. For video it is the big cost.
- Elasticsearch / OpenSearch
- Search engines that shard indexes by document, answer with scatter-gather, and offer BM25 ranking natively.
- Erasure coding
- Splitting data into pieces plus extra computed pieces, so lost pieces can be rebuilt without keeping three full copies. Storage services use it for very high durability.
- etcd
- A tool that stores small shared facts, such as who the leader is or which shards exist, using consensus.
- Event
- A record that something happened, such as an order placed. A log keeps events in arrival order.
- Event key
- The value hashed to choose an event's partition. Events with the same key, such as a customer ID, stay in order.
- Event streaming
- Writing events to a log 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 model and suits view counts and the product catalog.
- Exactly-once
- Each event's effect happens once. Kafka offers it inside Kafka with transactions, but a consumer writing elsewhere must still be idempotent.
- Expiry
- The time, as a Unix timestamp, after which a signed URL stops working.
F
- Failover
- Switching customers to a healthy region or node when theirs fails. `route()` does this for regions.
- Failover drill
- Turning a region off on purpose at a quiet time and measuring the real RPO and RTO. Targets mean nothing until tested.
- Fake clock
- A test replacement for the real clock, such as a lambda reading a one-slot array. Tests move time forward without waiting.
- Fan-out
- Copying a post into followers' feeds. Small authors are pushed at write time; big ones, over a threshold such as 10,000 followers, are pulled and merged at read time.
- Feed cache
- A cache of each account's feed, holding the latest post IDs, for the hottest accounts.
- Fencing token
- A number that grows with each new leader, such as its Raft 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.
- Follower
- A node that copies a leader's writes.
- FTS5
- SQLite's full-text search feature, which offers MATCH queries and BM25 ranking.
- Full-text search
- Finding products whose text contains the words typed, best match first. SQL's `LIKE '%word%'` can't do this efficiently.
G
- Geo DNS
- DNS that answers the shop's host name with the address of the region nearest to where the request comes from.
- Geohash
- A short text code for a map cell. It is the real-world version of the grid cells used for courier matching.
- Graceful degradation
- Keeping a reduced but working service when a part fails, instead of failing completely. For example, servers use a looser local rate limit when the shared store is down.
- Grid cell
- A small square of the map, about 1 km across when latitude and longitude are rounded to 2 decimals. Search the order's cell and its 8 neighbors to find the nearest courier.
H
- Hash ring
- A circle of hash values from 0 to 4,294,967,295. A key belongs to the next shard point clockwise, wrapping at the end.
- Headroom
- Spare capacity kept in reserve so a system can absorb surprises such as traffic spikes. Servers are often planned at about 70% of their maximum load, so a server that can handle 300 requests a second is counted as handling 210.
- Health check
- A regular test that tells whether a server or region is working. Failing ones are removed, and `route()` only sends traffic to healthy regions.
- Hex digits (hexadecimal)
- Base-16 digits, where `a` to `f` stand for 10 to 15. Eight hex digits give up to 4,294,967,295.
- HLS (HTTP Live Streaming)
- A common video format that lists short segments of each rendition in a playlist.
- HMAC
- A hash of a message mixed with a secret key. Anyone can read the URL, but only a holder of the secret can make a matching signature.
- Home region
- The region that holds a customer's data and serves them, chosen from their shipping state. It keeps each customer's writes in one place.
- Hot key
- A key that gets so much traffic that one shard is overloaded, such as the feed of a famous café. Even spread doesn't help it.
- HTTP status codes
- Three-digit numbers a web server returns with each response to say how the request went. For example, 429 Too Many Requests tells a client it has been rate limited, and it is often sent with a `Retry-After` header giving the seconds to wait before trying again.
I
- Idempotent
- Doing it twice has the same effect as doing it once. A retried order ID is stored once, and an idempotency key makes the payment provider return the first result.
- Indexer
- A worker that updates the search index when product events arrive. A reindex job rebuilds the index from the database to repair drift.
- Integrity
- Assurance that bytes arrived unchanged. It is checked by comparing content hashes.
- Inverted index
- A map from each word to the set of documents that contain it, like the index at the back of a book. An AND query intersects those sets.
- Isolation level
- How much concurrent transactions can see of each other. Read committed, snapshot isolation and serializable trade 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. It keeps events in partitioned logs, replicates partitions across brokers, and in version 4 runs on KRaft.
- Key salting
- Splitting a hot key into parts by adding a suffix such as `#0` to `#3`. Writes pick a part at random and reads fetch all parts.
- KRaft
- Kafka's own built-in Raft consensus, which replaces ZooKeeper in Kafka 4.
L
- Last-write-wins (LWW)
- Keeping the write with the later timestamp in a conflict and dropping the other. Sam's edit vanishes silently, so it suits only data where losing an edit doesn't matter.
- Latency
- How long one piece of work takes, measured in milliseconds, microseconds or nanoseconds. Memory is about 1,000 times faster than an SSD.
- Leader
- A node that accepts writes. Its copies are called followers.
- Leader election
- Followers voting for a new leader when they stop hearing from the old one. A candidate wins only with a majority.
- Leaderless replication
- The client writes to several replicas at once and no takeover is needed. Quorums decide, and reads must check several replicas.
- Leaky bucket
- A limiter in which requests join a queue that drains at a steady rate, smoothing bursts instead of allowing them.
- Lifecycle rules
- Storage settings that move or delete objects by age, for example to archive after 90 days.
- Linearizable
- The system behaves like a single copy of the data. Once a write is confirmed, every later read by anyone sees it, which stock and payments need.
- Local / global index
- A local index is kept per shard: writes stay on one shard but queries ask every shard. A global index is partitioned by the indexed value: queries ask one place but writes touch two shards.
- Local fallback limit
- A looser per-server limit used when the shared rate-limit store is down, instead of refusing everyone. It is a form of graceful degradation.
- Log
- A list that keeps every event in arrival order, so many readers can read it now or later. It differs from a queue, which deletes messages once handled.
- Log replication
- In Raft, the leader adds each change to its log and sends it to followers. The change is committed once a majority store it.
- Lost update
- An edit that disappears with no error, for example when last-write-wins drops one of two simultaneous writes.
- Lua script
- A small script run inside Redis as one atomic step. A token bucket uses it to read, add and write tokens without races.
M
- Majority
- More than half of all nodes, counting the candidate itself. Two majorities of one cluster always share a node, so two leaders can't win the same term.
- Mbps
- Millions of bits per second, the unit for link speed. 1 MB a second needs 8 Mbps.
- MD5
- A hash function that spreads well and is stable, used here to place keys on the ring. It is too weak for security, which isn't needed here.
- MessageDigest
- Java's class for hash functions such as MD5 and SHA-256. Use it, never `hashCode()`, for a stable hash.
- Metadata
- The facts about a file: name, size, owner, type and storage location. It lives in a database row that holds the object key.
- Min-heap
- A structure whose `poll()` removes the smallest item. Keeping at most k items and dropping the weakest yields the top k without a full sort.
- 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
- Splitting a large file into chunks sent in parallel, so a failed chunk can be retried on its own.
N
- Network partition
- A failure that cuts some nodes off from others so they can't talk. It can leave an old leader behind 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 under which a blob is stored in object storage, such as `products/mug-blue/1.jpg`.
- Object storage
- A service for storing blobs under object keys, such as Amazon S3.
- Offset
- An event's position in its partition, starting at 0. A reader can replay events by reading again from an old offset.
- Overload (method overloading)
- Java methods with the same name and different parameters. A shorter version supplies a default, such as 70% headroom.
P
- p99
- The latency under which 99 of 100 requests finish. Kettle & Crane targets a p99 under 300 ms.
- Partition (of a topic)
- One ordered list of events inside a topic. Events with the same key land in the same partition, so order is kept per key only.
- Paxos
- An older consensus algorithm that solves the same problem as Raft.
- Payment provider
- A company, such as Stripe, that holds card details so they never touch Kettle & Crane's servers.
- Payment state machine
- Payments are always in one state (created, authorized, captured or failed), with a list of allowed moves. Other moves are refused, so a late retry can't capture a failed payment.
- Peak factor
- The multiplier from average to peak traffic. Kettle & Crane assumes 10 times the average rate.
- Posting set
- The set of documents containing one word in an inverted index. An AND query intersects the posting sets.
- Prefix
- The letters a user has typed so far. Typeahead suggests names starting with it.
Q
- Quorum
- Enough replicas 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 matches first by relevance, a score of how well a document fits. It goes from simple term counts to BM25.
- Rate limiter
- A mechanism that caps how many requests one client may make in a period. It protects servers from bursts and shares capacity fairly.
- Read committed
- An isolation level that prevents dirty reads but still lets a row change between two reads.
- Read-your-writes
- You always see your own writes. "Saved" must look saved to you, even if other users see stale data.
- 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 job, such as the nightly one for payments, that compares your records with a partner's report and flags differences.
- Redis
- A fast in-memory store used for shared rate-limit counts and courier locations.
- Region
- A cloud provider's group of data centers in one area. Kettle & Crane adds `us-east` beside `us-west`.
- Regular expression
- A pattern for matching text. `[^a-z0-9]+` means one or more characters that aren't letters or digits.
- Rendition
- One quality level of a video, such as 720p at 3,000 kbps.
- Replay
- Reading events again from an old offset. It works because the log keeps events until retention removes them.
- Replica
- One copy of the data on another node. In a quorum store, N replicas hold each key.
- Replication lag
- How far a copy of the data is behind the source, usually milliseconds to seconds. It decides how much data a crash can lose (RPO).
- Resumable upload
- An upload cut off halfway that carries on from the last chunk that arrived instead of starting over.
- Retention
- How long a topic keeps events, such as 7 days, whether or not anyone has read them.
- Retry-After header
- An HTTP header on a refused request that tells the 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. If replication lags up to 2 seconds, RPO is about 2 seconds.
- RPS (requests per second)
- The number of requests a system handles each second. Peak RPS drives how many servers you need.
- RTO (recovery time objective)
- How long recovery may take. Spotting the outage in 3 minutes plus 10 to switch gives an RTO of about 13 minutes.
S
- Scatter-gather
- Sending a query to every shard, taking each shard's top results and merging them. It is as slow as the slowest shard, so add a timeout.
- Secondary index
- An index for finding rows by something other than the shard key, such as orders by SKU when orders are sharded by customer.
- Secrets manager
- A service for storing real secrets, such as signing keys, instead of putting them in code.
- Segment
- A few seconds of video, such as 4 seconds, fetched as one file. A playlist lists the segments of each rendition.
- Serializable
- The strongest isolation level, as if transactions ran one at a time. It prevents all the anomalies but is the slowest.
- serialVersionUID
- A version number Java asks exceptions to carry. Leave it as is.
- Session guarantee
- A promise to one user's session, such as read-your-writes or monotonic reads, rather than to everyone. These are cheap.
- SHA-256
- A secure hash function. It underlies HMAC and is used for content hashes of files and chunks.
- Shard / sharding
- One slice of a dataset held by its own database or node. Sharding (also called partitioning) splits data across shards by a hash of the shard key.
- Shard key
- The field hashed to decide which shard owns a row, such as the customer ID for orders.
- Signed URL
- A link to storage that works until it expires and carries a signature proving the app made it. It lets browsers upload and download directly.
- Single-leader replication
- One leader per piece of data, so every write has one clear order. 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 uses memory for every request.
- Snapshot isolation
- An isolation level that prevents non-repeatable reads but still allows write skew.
- Source of truth
- The authoritative data store. The product database is the source of truth and the search index is a fast-reading copy.
- Split brain
- Two nodes both believing they lead, such as an old leader cut off by a network partition. Fencing tokens guard against it.
- State machine
- A set of allowed states and moves between them, with every other move refused.
- Stop words
- Very common words, such as "the", dropped from search because they don't help distinguish documents.
- Storage class
- Storage tiers that trade price for speed: hot storage for product photos, cheaper cold or archive storage 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 each write waits for the slowest follower.
T
- Term
- A leader's numbered period in Raft. Each election starts a new 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 that decides between pushing a post into followers' feeds and pulling it at read time, 10,000 here.
- Throughput
- How much work a system finishes per second. More highway lanes add throughput; the drive takes just as long.
- Thumbnail
- A small copy of a photo, such as 200 or 800 px wide, that a worker makes after an upload.
- Token bucket
- A limiter giving each key a bucket of tokens that refills at a steady rate. Each request spends one, so a quiet client can save up a burst.
- Tokenize
- Lowercasing a text and splitting it into words, called tokens, before indexing it.
- Topic
- A named stream of events, split into partitions. In Kettle & Crane, the `orders` topic is keyed by customer ID.
- Trade-off
- What you give up to get something. A senior answer names the cost before the interviewer does.
- Transactional outbox
- Writing an order and its event row in one transaction, with a relay publishing the row. It avoids losing the event if a crash happens between the two writes.
- Transcoding
- Converting an uploaded video into several renditions cut into segments.
- TreeMap
- A Java map that stays sorted by key. `higherKey` finds the next point on the ring, and a `TreeSet` with `tailSet` powers typeahead.
- TTL (DNS)
- The time resolvers may keep a cached DNS answer. Lower it, for example to 60 s, before failover drills.
- Typeahead
- Suggesting names as the user types, by finding names that start with the typed prefix.
U
- Unix time
- A time written as seconds since January 1, 1970.
V
- Version
- A number that grows with each change, used to tell which copy of a value is newest.
- Version vector
- One counter per replica, which lets real systems tell a true conflict from one write following another.
- Virtual node (vnode)
- One of many ring points given to each shard, so many small arcs average out into an even spread. 100 per shard is the default.
W
- Window edge burst
- A fixed window's weakness: a client sends the full limit just before a window ends and again just after, getting double the limit in a second.
- Write skew
- Two transactions each check a rule, then both write and together break it, such as two baristas both signing off when one must stay. Snapshot isolation allows it.
Z
- ZooKeeper
- A tool for storing small shared facts using consensus. Kafka 4 no longer needs it, because KRaft replaces it.