System Design Beyond the Basics in JavaScript
Glossary
159 terms from System Design Beyond the Basics in JavaScript, 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, so you cache only that share. Kettle & Crane's customer cache is sized this way.
A
- Ack
- A confirmation from a replica that it stored a write. A quorum write waits for W acks.
- Active-active / active-passive
- In active-passive, one region serves traffic while the other keeps copies and waits. In active-active, both regions serve customers, which gives lower latency but risks conflicting writes.
- 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 routing method where several regions share one IP address and the internet's routing picks the nearest one. It is an 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. Kettle & Crane limits requests per API 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-most-once
- Commit the offset before processing, so there are no duplicates but a crash can lose an event. It suits view counts, never orders.
- Atomic increment
- One step that adds to a counter and returns the new value, such as Redis's INCR. It stops two servers from both reading 4 and both writing 5.
B
- Bandwidth
- A network link's throughput, counted in bits per second. Mbps means millions of bits per second, so moving 1 MB a second needs 8 Mbps.
- beforeEach
- A function from node:test that runs before every test to prepare a clean state, such as a fresh region and a reset fake clock.
- Binary search
- A fast way to find a position in a sorted array by repeatedly checking the middle and discarding half of the remaining range. It is used to find the next point clockwise on a hash ring and to find matches in sorted lists such as typeahead suggestions.
- Bit
- A single 0 or 1; a byte is 8 bits. Network speed is counted in bits, file sizes in bytes.
- Blob
- A file's raw bytes, such as a product photo or class video. Blobs go in object storage, with facts about them in the database.
- BM25
- The standard search ranking formula: rare words count more than common ones and long texts count a little less. FTS5's bm25() returns negative scores, so lower is better.
- Bottleneck
- The one component that limits the whole system, like a bottle's neck limiting how fast it pours. Deep dives focus on it.
- Broker
- A Kafka server that stores partitions. Spreading partitions across brokers spreads the load.
- Buffer
- Node.js's built-in type for holding raw bytes. It is used for things like upload chunks and for comparing signatures byte by byte.
C
- Cache busting
- Putting the content hash in a file name, like mug-blue.3f9a1c.jpg, so a changed photo gets a new name. The CDN can then cache every name forever.
- Cassandra / 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. A reply to a review is never visible without the review.
- CDN
- A network of servers that cache files near users. Kettle & Crane serves images and video through cdn.kettleandcrane.com.
- Change data capture (CDC)
- Reading a database's own change log and publishing every change as an event, as an alternative to an outbox.
- Chunk
- One piece, say 8 MB, of a large file in a multipart upload. A failed chunk can be resent alone.
- Committed (Raft)
- In Raft, a change is committed once a majority of nodes store it, and it then 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.
- CommonJS
- Node's classic module style: files list what others may use with module.exports and load other files with require.
- Comparator
- A function passed to sort that says which of two items goes first. It returns a negative number, zero or a positive number.
- Conflict
- Two writes to the same key happening at once in different places, which 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 solve it.
- Consistency model
- A promise about what a read may return, from linearizable down to eventual. Stronger promises cost more waiting and availability.
- Consistent hashing
- Placing keys and nodes on a hash ring so that adding a shard moves only about its fair share of keys, rather than most keys as with % n.
- Constant-time comparison
- A comparison that takes the same time whether the first or last character differs, so attackers can't guess a signature by timing. Node provides it as crypto.timingSafeEqual.
- 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 allows deduplication.
- Cross-region replication
- Each region copying its data to the other for disaster recovery, done asynchronously because the trip takes about 70 ms.
- crypto.createHash
- A function in Node's built-in `node:crypto` module that creates a hash (and, with its sibling `createHmac`, keyed HMACs) from data. MD5 spreads values evenly but is too weak for security, so it suits uses like ring positions, while SHA-256 is a secure hash suited to HMAC signatures and content hashes.
D
- Data center
- A building full of servers. A region is a group of them in one area.
- Data residency
- Laws in some countries requiring their citizens' data to stay inside the country, so a global shop needs a region there.
- Deduplication
- Storing files or chunks with the same hash only once. Chunks 1 and 2 of the test video are identical, so one copy is enough.
- Deep dive
- A close look at one hard part of a design, such as how payments avoid double charges, done in minutes 30 to 40 of the interview.
- Direct upload
- A browser sends file bytes straight to object storage using a signed URL, so the app handles only small requests.
- Dirty read
- Seeing another transaction's unfinished changes. Read committed prevents it.
- Distributed rate limiting
- Keeping one shared count per key in a fast store such as Redis, so a limit doesn't multiply with server count. If the store fails, each server falls back to a looser local limit.
- DNS TTL
- The time resolvers may keep a DNS answer. It is lowered, for example to 60 s, before failover drills so changes spread quickly.
- Double-entry ledger
- Money records where each movement is written as entries in two or more accounts that add up to zero. Mistakes are fixed with new entries, never edits.
E
- Egress
- Data leaving your network, which clouds charge for. For video it is the big cost, so a CDN serves it.
- Elasticsearch / OpenSearch
- Search engines that shard an index by document and answer queries by scatter-gather, with replicas of each shard.
- Erasure coding
- Splitting data into pieces plus extra computed pieces so lost pieces can be rebuilt, giving high durability without keeping three full copies.
- etcd / ZooKeeper
- Systems that store 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 streaming
- Writing events to a log that many readers read, now or later. Apache Kafka is the best-known tool.
- Eventual consistency
- If writes stop, all copies end up the same. It 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.
F
- Failover
- Switching customers to a healthy region when one fails. A failover drill turns a region off on purpose to measure the real RPO and RTO.
- Fair share
- The portion of keys a new shard should take: one fifth when going from 4 to 5 shards.
- Fake clock
- A function returning a time you control, so tests of time-based code, such as a token bucket, never have to wait.
- Fan-out (push/pull)
- Below a follower threshold (10,000), a post is pushed into each follower's cached list. Bigger authors' posts are pulled and merged at read time.
- Feed cache
- A cache of each user's latest post IDs so the feed opens fast.
- Fencing token
- A number that grows with each new leader, such as its term. Storage rejects writes carrying a lower token, so an old leader's writes bounce.
- Fixed window counter
- A limiter that counts requests per key per time window. It is cheap but allows a window edge burst.
- Follower
- A copy of a leader's data that receives its changes.
- FTS5
- sqlite's extension that keeps an inverted index for you in a virtual table. MATCH runs a query and bm25() scores matches.
G
- Geo DNS
- DNS that answers the shop's host name with the address of the region nearest the requester.
- Graceful degradation
- Keeping a reduced service when a part fails instead of refusing everyone, such as a looser local rate limit when the shared store is down.
- Grid cell / geohash
- A map square about 1 km across made by rounding latitude and longitude; courier search checks the order's cell and its 8 neighbors. Geohash is the real-world version, a short text code per cell.
H
- Hash ring
- A circle of hash values from 0 to 4,294,967,295. A key belongs to the first shard point clockwise from its hash, wrapping at the end.
- Headroom
- Spare capacity for surprises, kept by planning servers at about 70% load so queues don't grow.
- Health check
- A regular test that tells whether a server or region is working. Failed checks remove a server from use or trigger failover to another region.
- Hex digits
- Base-16 digits where a to f stand for 10 to 15. parseInt(text, 16) turns hex text into a number.
- HLS
- A common video format that cuts each rendition into short segments listed in a playlist.
- HMAC
- A hash of a message mixed with a secret key. Only the secret's holder can produce a matching signature, and any change to the message changes it.
- Home region
- The region that holds a customer's data and serves their writes, chosen from their shipping state.
- Hot key
- A key, such as a famous café's feed, that gets so much traffic that even an even spread of keys doesn't help. Key salting splits it.
I
- Idempotent
- Safe to repeat: doing it twice has the same effect as once. Consumers and payment calls are made idempotent so retries don't duplicate work.
- Indexer
- A worker that updates the search index when product events arrive. A reindex job rebuilds the index from the database to repair drift.
- INSERT OR IGNORE
- SQLite's insert that silently skips a row whose primary key already exists. A retried order ID is stored once.
- Integrity
- Assurance that bytes arrived unchanged, checked by comparing content hashes.
- Inverted index
- A map from each word to the set of documents containing it, like a book's back-of-book index. An AND query intersects the sets.
- Isolation level
- How much concurrently running transactions can see of each other. Read committed, snapshot isolation and serializable prevent progressively more problems at progressively lower speed.
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, keeping events in partitioned logs. Kafka 4 runs on KRaft and replicates partitions across brokers.
- 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 Raft-based 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 delivery note was silently lost this way.
- Latency
- How long one piece of work takes. Memory reads take about 100 ns, SSD reads 100 µs and a trip across the US 70 ms.
- Leader
- A node that accepts writes and sends them to its 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 quorums decide what reads see. No takeover is needed.
- Leaky bucket
- A limiter where requests join a queue that drains at a steady rate, smoothing bursts instead of allowing them.
- Lifecycle rules
- Rules that move or delete stored objects by age, for example to cheap archive storage after 90 days. Storage classes trade price for speed.
- Linearizable
- The system behaves like one copy of the data: once a write is confirmed, every later read sees it. Stock and payments need it.
- Local / global index
- A local index is kept per shard, so writes are cheap but queries ask every shard. A global index is partitioned by the indexed value, so queries are cheap but writes touch two shards and the index can lag.
- Log
- A structure that keeps every event in arrival order so many readers can read it, now or later. A queue, by contrast, deletes messages once handled.
- Lost update
- An edit that vanishes with no error, such as Sam's note dropped by last-write-wins.
- Lua script (Redis)
- A script run inside Redis as one atomic step, used to make a token bucket's read-add-write safe across servers. Redis is the fast shared store used for counts.
M
- Majority
- More than half of all nodes, counting yourself. Two majorities of one cluster always share a node, so two leaders can't win the same term.
- Metadata
- Facts about a file: name, size, owner, type and object key. It lives in a database row.
- Monotonic reads
- You never go back in time: once you've seen version 5 you never get version 4. It stops an order vanishing on refresh.
- Multi-leader replication
- Several leaders, usually one per region, each accept writes and send them to the others. Writes stay local but can conflict.
- Multipart upload
- Sending a big file in chunks, in parallel, so a failed chunk is retried alone and a cut-off upload resumes from the last chunk that arrived.
N
- Network partition
- A failure that cuts nodes off from each other so they can't communicate. It can cause split brain and forces a trade between consistency and availability.
- node --test
- Node's built-in test runner. test() registers a test and node:assert's strictEqual and deepStrictEqual throw when values differ.
- node:sqlite
- Node 22's built-in SQLite database module, still experimental, so Node prints an ExperimentalWarning that you can ignore.
- Numeric separators
- A JavaScript feature letting you write 86_400 for 86400; the underscore is ignored.
O
- Object storage / object key
- Object storage, such as Amazon S3, holds blobs, each under an object key, the name it is stored by, like products/mug-blue/1.jpg.
- Offset
- An event's position within its partition, starting at 0. Readers can replay by reading again from an old offset.
P
- p99
- A latency target where 99 of 100 requests are faster than the stated time, such as 300 ms.
- Partition (of a topic)
- One ordered list of events; a topic is split into several. More partitions spread more load, with order only per key.
- Partitioning (sharding)
- Splitting data across several databases (shards) by a key, so each holds only part of it. Consistent hashing decides which shard owns which key.
- Paxos
- An older consensus algorithm that solves the same problem as Raft.
- Payment provider
- A service such as Stripe that holds card details so they never touch Kettle & Crane's servers.
- Peak factor
- How many times busier the busiest moment is than the daily average. RPS means requests per second.
- Posting set
- The set of documents containing a given word, stored in an inverted index.
- Primary key
- A database column that allows each value to exist only once. It lets each order ID appear once in the orders table.
Q
- Quorum
- Enough replicas to decide. With N copies, a write waits for W acks and a read asks R replicas; if W + R > N, reads overlap the latest write.
R
- Raft
- The common consensus algorithm: followers elect a leader by majority, elections start numbered terms, and changes commit once a majority stores them.
- Ranking
- Putting best search matches first by relevance. The simplest score is term frequency, how often the query's words appear.
- Rate limiter
- Caps how many requests one client may make in a period. A refused request gets HTTP status 429 (Too Many Requests) and a Retry-After header saying how many seconds to wait.
- Read-your-writes
- You always see your own writes, so a saved profile looks saved to you. It is done by reading only from replicas at least as new as your last write.
- Rebalancing
- Moving data when shards change, in the background: copy keys while the old shard serves them, switch the ring, then delete old copies.
- Reconciliation
- A nightly job that compares your ledger with a partner's report, such as the payment provider's, and flags differences.
- Region
- A cloud provider's group of data centers in one area. Kettle & Crane runs us-west and us-east.
- Rendition
- One quality level of a video, such as 1080p at 5,000 kbps or 480p at 1,000 kbps.
- Replay
- Reading events again from an old offset. Retention limits how far back you can go.
- Replica
- One copy of a piece of data on a node. Replicas are kept in step by replication, and quorum reads and writes count them.
- Retention
- How long a topic keeps events, say 7 days, whether or not anyone has read them.
- RPO / RTO
- RPO is how much recent data you may lose in a disaster, measured in time. RTO is how long recovery may take.
S
- Scatter-gather
- Sending a query to every shard, taking each one'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, or an environment variable, where real secrets live instead of in code.
- Segment
- A few seconds of video, such as 4 seconds, fetched as one file and listed in a playlist.
- Session guarantee
- A promise to one user's session, such as read-your-writes or monotonic reads, not to everyone. It is cheap, needing one version number per session.
- Shard key
- The field whose value decides which shard holds a row, such as customer ID for orders.
- Signed URL
- A storage link that works only as issued and until it expires, proved by an HMAC signature. It lets browsers upload and download directly.
- Single-leader replication
- One leader per piece of data takes every write, so writes have one clear order; if the leader dies, a follower must take over.
- Sliding window log
- A limiter that stores the time of each allowed request and counts only those in the last window. It is exact but costs one timestamp per request.
- Source of truth
- The main database, whose copy is authoritative. The search index is a copy built 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.
- State machine
- A list of allowed states and moves, with every other move refused. A late retry can't capture a failed payment.
- Stop words
- Very common words such as "the" and "in" that are dropped from search because they don't help.
- Synchronous replication
- The leader confirms a write only after followers have it. Nothing is lost if the leader dies, but writes wait for the slowest follower. Semi-synchronous waits for just one.
T
- Term
- A leader's numbered period in Raft. A node that hears of a higher term knows it is out of date and steps down.
- Throughput
- How much work a system finishes per second, as opposed to latency, how long one piece takes.
- 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 capacity 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, called tokens, as the first step of building a search index.
- Topic
- A named stream of events in Kafka, split into partitions.
- Trade-off
- What you give up to get something. Seniors name it in the form "We choose X because Y. The cost is Z."
- Transactional outbox
- Writing the order and its event row in one transaction, with a relay publishing the row, so an event is never lost between the two steps.
- Transcoding
- Converting an uploaded video into several renditions cut into segments.
- Typeahead
- Suggesting names as the user types. A binary search finds the first name that could start with the typed prefix.
V
- Version
- A number that grows with each change, used to tell which replica's 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 ring points given to each shard, so many small arcs average out into an even spread.
W
- Window edge burst
- The weakness of a fixed window: five requests at 0:59 and five at 1:00 all pass, giving 10 in about a second.
- Write skew
- Two transactions each check a rule, then both write, together breaking it. For example, two baristas each see the other on shift and both sign off.