Glossary
164 terms from System Design Basics in C#, in plain words, each with the chapter that teaches it.
A
- ACID (atomicity, consistency, isolation, durability)
- The four promises a database transaction makes: all of it happens or none, rules still hold, concurrent transactions don't see each other's half-done work, and committed changes survive a crash.
- ADO.NET / Dapper / EF Core
- Packages that let C# programs talk to a real database, such as PostgreSQL or SQL Server, by sending SQL or mapping objects to tables. In this material the database is modeled in memory instead, so none of them is actually used.
- Alert
- An automatic message to a person when a metric crosses a line, such as an error rate above 1% for 5 minutes.
- API (Application Programming Interface)
- The set of requests a program accepts from other programs, such as `GET /v1/products/{sku}` on api.kettleandcrane.com. Apps and websites use it instead of touching the database directly.
- API key
- A long secret string a caller sends, usually in a header, to prove who it is. The server looks it up to identify the caller.
- Asynchronous work
- Work done a moment later by something else, so the request doesn't wait for it. The confirmation email and Alex's packing slip are examples. It is different from C#'s `async`/`await`, which is about waiting inside one program.
- At-least-once delivery
- A promise most queues make: every message arrives, but some may arrive twice, for example when a worker finished the work and crashed before telling the broker. Consumers must therefore cope with duplicates.
- Atomic
- An operation that can't be split, so all of the change happens or none of it, and nothing can sneak in between the check and the change. A single `UPDATE ... WHERE qty >= ?` is atomic, which stops two checkouts selling the last bag.
- Authentication
- Proving who the caller is, for example with a token. If it fails, the server answers 401.
- Authorization
- Deciding what a caller you already know is allowed to do. A customer may read their own orders but only staff may read everyone's. If it fails, the server answers 403.
- Auto-increment ID
- A number the database hands out in order (1, 2, 3...) for each new row. The URL shortener turns it into a short code.
- Autoscaling
- Automatically adding servers when load rises and removing them when it falls, by a rule such as "keep average CPU under 60%".
- Availability
- The share of time a system answers requests, given as a percentage such as 99.9%. It is one of the non-functional requirements.
B
- Back pressure
- Pushing back on producers when a queue is full, so the queue doesn't grow until memory runs out. A bounded `Channel` does it by making `WriteAsync` wait or `TryWrite` return `false`.
- Back-of-the-envelope estimate
- A rough calculation, such as average and peak requests per second or yearly storage. Its goal is the order of magnitude, so you don't build something far too big or too small.
- Backups
- Copies of data kept somewhere else so it can be restored after a disaster, such as a lost server or a bad deletion. A backup is only trustworthy once you have tested it by actually restoring one.
- Base62
- Writing numbers with 62 symbols (0-9, a-z, A-Z) instead of 10, so a number becomes a much shorter string. The URL shortener uses it to turn an ID like 125000 into `ww8`.
- Batching
- Grouping many writes into one unit, such as one commit after many inserts, so the slow wait for the disk happens once.
- Body (HTTP)
- The data that follows the headers and a blank line in an HTTP request or response, such as a new order's JSON.
- Broker
- The program that stores a message queue, such as RabbitMQ or Amazon SQS, so workers can run on other machines and messages survive a restart.
C
- Cache
- A small, fast store holding copies of data that is slow to get, such as a product page read thousands of times between price changes. Redis and Memcached are common shared cache servers.
- Cache hit / miss
- A hit means the data was found in the cache; a miss means it wasn't, so you fetch it from the slow source. The hit ratio is hits divided by all lookups.
- Cache invalidation
- Removing or updating a cached copy when the underlying data changes. When Jo changes a price, the app writes to the database and then deletes the cached key.
- Cache stampede
- What happens when a popular entry expires and many requests miss at once and all hit the database together. A fix is to let one request reload it while the others wait.
- Cache-aside
- The usual caching pattern: the app checks the cache first, and on a miss reads the database and stores the result in the cache.
- Cache-Control header
- An HTTP header that tells browsers and CDNs how long to keep a file; `max-age=86400` means one day. It is a TTL set through HTTP.
- CAP theorem
- During a network partition a system must choose consistency (refuse rather than be wrong) or availability (answer, maybe with stale data). Partitions can't be ruled out, so you choose per feature.
- CDN (content delivery network)
- Servers in many cities that hold copies of files, called edge locations, so a customer in Miami gets product photos from nearby instead of Portland.
- Celebrity problem
- The trouble fan-out on write has with a source that has a huge following: each post means a very large number of writes, and the last followers see it late. Hybrid fan-out is the usual fix.
- Channel
- A .NET queue, from `System.Threading.Channels`, that tasks can share safely. Producers write with `WriteAsync`/`TryWrite`, consumers read with `await foreach` over `ReadAllAsync()`, and `Complete()` ends the stream; it serves here as an in-program stand-in for a message broker.
- Circuit breaker
- A guard that notices repeated failures and stops calling a failing service for a while. It is closed while calls pass, open after too many failures (calls fail at once), and half-open after a wait, when a trial call is allowed.
- Client / server
- A client is a program that asks for something, such as a browser or `HttpClient`; a server answers.
- Commit
- The step that saves a transaction's changes, waiting until the data is safely on disk, which is slow. One commit after many inserts waits only once.
- Component
- One part of a system, such as a web server, database, cache or queue. A whiteboard sketch shows components as boxes.
- Consensus
- The process of getting several servers to agree on something, such as which replica becomes the new primary. It is needed whenever a group of machines must make one shared decision even if some fail or messages are delayed.
- Consistency
- Whether all readers see the latest data. Strong consistency means every read sees the latest write, while eventual consistency means copies may be briefly out of date but catch up. In ACID, it also means rules such as "qty is never negative" still hold.
- Consistent hashing
- A way of sharding that moves only a fraction of the keys (about a fifth when going from four to five shards) when shards are added or removed. A plain `% shardCount` scheme, by contrast, moves most of them.
- CRC32
- A checksum, a small number computed from bytes and normally used to spot damaged data. It also works as a stable hash, giving the same number for the same key on every machine and run, so a key always lands on the same shard.
- Cross-shard query
- A question that doesn't include the shard key, so it must ask every shard and combine the answers, such as "best sellers this week".
- curl
- A command-line tool that sends HTTP requests; with `-i` it prints the response headers as well as the body.
D
- Database
- A program that stores data safely and finds it again. The main kinds are relational and NoSQL.
- Dead-letter queue
- A queue where messages go after failing too many times, so a person such as Priya can look at them. Otherwise a bad message would be retried forever.
- Denormalization
- Storing a copy of data in the shape a page needs, even though it repeats data held elsewhere. It trades some staleness and storage for fast reads, like the `best_sellers` table.
- Design document
- A short shared description of what you will build and why, which the team can review before anyone writes code.
- DNS (Domain Name System)
- The internet's phone book: it turns a name like shop.kettleandcrane.com into an IP address.
- Document store
- A NoSQL database that keeps each record as a JSON-like document, good for products with varied fields. MongoDB is an example.
- Downtime
- The time a system is not answering. Each "nine" of availability cuts yearly downtime by ten.
- Durability
- Saved data is never lost, even after a crash. Confirmed orders at Kettle & Crane must be durable.
E
- Endpoint
- One method-and-path pair an API accepts, such as `GET /v1/products`.
- Error rate
- The share of requests that fail, a metric often used to trigger alerts.
- Eventual consistency
- Reads may be briefly out of date, but once writes stop every copy catches up, as with read replicas. It lets any copy answer, so it is faster and more available.
- Eviction
- Throwing an entry out of a full cache to make room, such as the least recently used one.
- EXPLAIN
- A SQL prefix that makes the database show how it will run a query, such as `SCAN orders` or `SEARCH orders USING INDEX ...`.
- Exponential backoff
- Doubling the wait after each failed retry (0.1 s, 0.2 s, 0.4 s...), so a struggling server has room to recover.
F
- Failover
- Switching to a standby when the main part fails, such as promoting a read replica to primary or a spare load balancer taking over an address.
- Fake clock
- A clock function a test controls by hand, so a test of a 60-second TTL doesn't have to wait 60 seconds.
- Fallback
- A simpler answer shown when a part fails, such as a cached "Popular this week" list when recommendations are down.
- Fan-out
- Copying one post or message to many readers. Fan-out on write pushes the post into each follower's feed when posted; fan-out on read gathers posts when the feed is opened; hybrid mixes both for very popular sources.
- Feed
- A list of posts from the cafés a customer follows, newest first.
- Functional requirement
- What the system does, such as "customers can check out".
G
- Graceful degradation
- Offering less instead of nothing when a part fails, for example showing a cached list or letting emails wait on the queue.
H
- Hash sharding
- Choosing a shard by turning the key into a number with a stable hash and taking the remainder after dividing by the shard count.
- Headers
- The `Name: value` lines in an HTTP request or response that carry extra information, such as `Authorization`, or `Content-Type`, which says what kind of data the body holds (for example `application/json`).
- Health check
- A regular test, such as `GET /v1/health`, that a server is answering. A load balancer marks a failing server down until it passes again.
- Horizontal scaling
- Handling more load by adding machines that share the work. It has no ceiling, but data must be split between them.
- Hot key
- One key, such as a café with hundreds of orders a week, that gets far more traffic than the others and overloads its shard.
- Hot spot
- A shard doing most of the work, for instance when range sharding by date sends every new order to the newest shard.
- HTTP (Hypertext Transfer Protocol)
- The plain-text protocol browsers and servers speak: a request with a method, path and headers goes out, and a response with a status code comes back.
- HTTP methods
- The first word of an HTTP request, saying what to do: `GET` reads, `POST` creates, `PUT` replaces and `DELETE` removes.
- HttpClient
- The .NET class used as a client to call a web API; its `Timeout` property sets how long to wait.
- HttpListener
- A small web server class that comes with .NET. It waits for HTTP requests on a port and lets code read each request and write a response, as in the `shop_api.cs` example.
- HTTPS / TLS
- HTTP with encryption (via TLS), so nobody in between can read card numbers or tokens.
I
- Idempotency key
- A unique ID the app sends with a create request, in an `Idempotency-Key` header. The server remembers keys it has seen, so a retried checkout returns the first order instead of charging twice.
- Idempotent
- Doing it twice has the same effect as doing it once. `GET`, `PUT` and `DELETE` are idempotent; `POST` creating an order is not, unless you add an idempotency key.
- Idempotent consumer
- A queue consumer that gives the same result if it handles a message twice, typically by recording which IDs are done and skipping repeats.
- Index
- A sorted list of one column's values, each pointing at its rows, so the database can jump straight to matches instead of scanning every row. It slightly slows writes, so index only the columns you search by.
- IP address
- A number such as 203.0.113.7 that identifies a machine on the network.
J
K
- Kafka
- A popular message broker built around topics, commonly used for event streaming. Producers publish events to a topic and many consumers can read them independently.
- Key-value store
- A NoSQL database that finds one value by its key, like a dictionary. It suits sessions and carts, and the URL shortener. Redis and DynamoDB are examples.
L
- Latency
- How long one request takes, measured in milliseconds, microseconds or nanoseconds. It is a non-functional requirement.
- Layer 4 / Layer 7
- Two kinds of load balancer. Layer 4 looks only at addresses and ports and passes bytes on unread, so it's very fast; Layer 7 reads the HTTP request, so it can route by path and handle HTTPS.
- Least connections
- A load-balancing rule that sends each request to the server with the fewest requests still open, which copes better than round robin when requests cost different amounts.
- LINQ
- C#'s built-in query methods for collections, such as `Where`, `Select`, `MinBy` and `Take`.
- Load balancer
- A server in front of the app servers that takes every request and passes it to one of them, so customers only ever see one address. nginx and HAProxy are common ones you run yourself.
- lock
- A C# statement that lets only one thread at a time run the code inside its block. It is used to make a check-and-subtract on stock atomic and to model a database transaction.
- Logs
- Records of events, such as each failed charge, kept to investigate problems.
- LRU (least recently used)
- An eviction rule: when the cache is full, throw out the entry that hasn't been read for the longest time.
M
- Message queue
- A holding area where producers put messages, such as order IDs, and consumers take them off later. Checkout replies at once while workers handle slow jobs like email.
- Metrics
- Numbers measured over time, such as error rate or latency, which monitoring and alerts are built on.
- Microservices
- An architecture that splits a system into small programs, each with its own data and deployment, that talk to each other over APIs. It is the alternative to building one monolith, trading simplicity for independent scaling and deployment.
- Millisecond / microsecond / nanosecond
- Tiny time units: a thousandth, a millionth and a billionth of a second. Latency numbers are quoted in them.
- Monitoring
- Watching logs, metrics and alerts to see failures early.
- Monolith
- One program that does everything, often with a few helper components. It is simple to build and run, which suits a small team like Kettle & Crane's.
N
- Network partition
- A failure where some servers can't reach others, for example replicas losing contact with the primary.
- Nines
- A way of describing availability: 99.9% is "three nines". Each extra nine cuts allowed downtime by ten and costs much more to build.
- Non-functional requirement
- How well the system does its job: latency, availability, durability and scalability.
- NoSQL
- Databases that aren't relational tables, such as key-value, document and wide-column stores (huge tables over many machines, like Cassandra). They give up some relational features for simple, very large scale.
O
- Object storage
- A service that stores any number of files by name, cheaply and durably. Amazon S3 is the best-known; Kettle & Crane's photos could live there and the CDN fetches them.
- Order of magnitude
- The rough size of a number, such as 2, 200 or 20,000 requests a second. Estimates aim for it because each needs a very different design.
- Outbox
- A queue of work to do once an order is safely saved, written to only after the commit so nobody is told about an order that wasn't stored.
P
- p99 (percentile)
- The time 99% of requests beat; the slowest 1% take longer. An average of 80 ms can hide a p99 of 3 seconds.
- Pagination
- Returning a long list in pieces, using `?page=2` or `?after=K-1040`.
- Peak factor
- How many times the average load the busiest moment reaches; the shop's holiday sale hour is about 10. Peak RPS is average RPS times this.
- Polling
- The client repeatedly asking "anything new?" every few seconds. It is simple but slow to notice news and wasteful when there is none.
- Port
- A numbered door on a machine that lets one computer run many network services at once. For example, 443 is used for secure web traffic and 8121 for the example API.
- Precompute
- Calculating a heavy result ahead of time, such as "Best sellers this week" every 10 minutes, and storing it so page views just read it.
- Presence
- Whether someone is online. The chat design tracks it with a TTL key refreshed every 10 seconds that simply expires when the person leaves.
- Primary
- The database copy that takes every write and sends changes to the read replicas.
- Producer / consumer
- The producer is the code that puts messages on a queue, such as checkout; the consumer, or worker, takes them off and does the work, such as sending email.
- Pub/sub (publish/subscribe)
- One message is published to a topic and every subscriber gets a copy, unlike a queue where one consumer gets each message.
R
- Race condition
- A bug where the result depends on how two operations overlap in time, such as two checkouts both reading 1 bag in stock and both selling it.
- Range sharding
- Giving each shard a range of keys, such as January to March on shard 0. It makes range queries easy but risks hot spots.
- Rate limiting
- Capping how many requests each client can make, so one caller can't overload the service. It is covered in the next book.
- Read replica
- A copy of the database that receives each change from the primary and answers reads, so several servers can share the read load.
- Read-heavy / read/write ratio
- A read-heavy system is read far more than changed; the shop's ratio is about 100 product views per order. The ratio tells you which side to scale first.
- Read-your-writes
- A promise that a user always sees their own latest changes, for example by reading from the primary for a short time after they write.
- Redirect
- A response telling the browser to go to another address given in a `Location` header. 301 means moved for good (browsers remember it); 302 means moved for now, so each click returns to you and can be counted.
- Redundancy
- Keeping two or more of each part, so one failure doesn't stop the system.
- Relational database
- A database with tables of fixed columns, queried with SQL and able to combine tables. It suits orders, stock and money; PostgreSQL and MySQL are examples.
- Replication
- Keeping copies of a database on several servers.
- Replication lag
- The delay before a replica has a change made on the primary, usually milliseconds but sometimes seconds when the primary is busy.
- Requirement
- Something the system must do or be. Requirements are functional (what it does) or non-functional (how well).
- Resharding
- Moving data to a new number of shards. With `% shardCount` most keys move (795 of 1,000 going from four to five shards), which is costly.
- REST
- A common style for web APIs: URLs name resources with nouns (`/v1/orders`) and the HTTP method says what to do with them.
- Retry
- Trying a failed call again, with exponential backoff and jitter. Only idempotent work, or work with an idempotency key, is safe to retry.
- Rollback
- Undoing all of a transaction's changes when an error occurs, so an order reserves every item or none.
- Round robin
- Giving requests to servers in turn: app1, app2, app3, then app1 again.
- Router
- The app component that sends writes to the primary database and reads to a read replica. It lets an app spread read traffic over copies while keeping every write on one server.
- RPS (requests per second)
- How many requests arrive each second. Average RPS is daily requests divided by 86,400; peak RPS multiplies that by the peak factor.
S
- Scalability
- Keeping working as the load grows, such as ten times the visitors at the holiday sale.
- Scan
- The database reads every row of a table to answer a query. An index avoids it.
- Session
- What a server knows about one visitor, such as who is logged in and what's in their cart.
- Shard / Shard key
- A shard is one piece of a table split across databases. The shard key, such as `customer_id`, is the column whose value decides which shard holds a row.
- Sharding
- Splitting one table's rows across several databases, which helps scale writes but brings hot keys, cross-shard queries and resharding costs. Don't shard until one well-indexed database isn't enough.
- Short code
- The few symbols after the slash in a short link, such as `abc12` in `go.kettleandcrane.com/abc12`.
- SLO (service level objective)
- A target a team sets for a service, such as "checkout is available 99.9% of the time".
- SPOF (single point of failure)
- A part whose failure stops everything, such as the one database or one load balancer. Redundancy removes it.
- SQL
- The language used to ask relational databases questions and change data, for example `CREATE INDEX` or `UPDATE stock SET qty = qty - ? WHERE ...`.
- SSD
- A solid-state drive, much faster than a spinning hard disk (about 0.1 ms versus 5 ms per read).
- Stable hash
- A hash that gives the same number for the same key on every run and machine. .NET's `string.GetHashCode()` is not stable, so customers would change shards after a restart.
- Stale
- A cached or copied value that no longer matches the database.
- Stateless server
- A server that keeps no session data in its own memory, but in a database or cache. Any server can then answer any request, so adding servers is easy.
- Status codes
- The number that starts an HTTP response: 2xx means success, 4xx the client's mistake, 5xx the server's problem. Common ones are 200 OK (found), 201 Created (order placed), 400 Bad Request (invalid input), 401 Unauthorized (not logged in), 403 Forbidden (known but not allowed), 404 Not Found (unknown SKU), 409 Conflict (clashes with current state), 429 Too Many Requests (hammering the API), 500 Internal Server Error (a bug) and 503 Service Unavailable (try later); 301 and 302 are redirects.
- Sticky session
- A load balancer sending a customer to the same server every time because that server holds their cart in memory. If it dies, the cart is lost.
- Stopwatch
- A precise .NET timer you start and stop, used to measure scans, cache hits and commits.
- Strong consistency
- Every read sees the latest write, as when reading from the primary. It is simpler to reason about and right for stock and payments.
- Synchronous work
- Work the reply must wait for, such as saving the order before replying at checkout.
- System design
- Deciding the parts (components) of a system and how they talk to each other, before or while building it, often as a whiteboard sketch.
T
- TCP
- The connection protocol that delivers bytes in order and resends lost ones; HTTP runs on top of it.
- Timeout
- The longest you'll wait for a reply to a network call. Without one, a hung server makes requests pile up holding threads.
- Token
- A long secret string sent in a header, such as `Authorization: Bearer <token>`, that proves who the caller is. The server answers 401 if it is missing or wrong.
- Transaction
- A group of statements that succeed or fail together: if all finish it commits, and if an error escapes it rolls back everything.
- TTL (time to live)
- How long a cached entry stays valid. After that many seconds it expires, so the next lookup misses and fetches a fresh copy.
U
- URL shortener
- A service that turns long addresses into short links like `go.kettleandcrane.com/abc12` and redirects visitors to the original.
V
- Versioning
- Putting a version such as `/v1/` in API paths, so `/v2/` can appear while old apps keep using `/v1/`.
- Vertical scaling
- Moving to a bigger machine. It is simple, but there is a largest machine you can buy.
W
- WebSocket
- A connection that starts as an HTTP request and stays open, so either side can send a message at any time. The chat server holds one per person.
- Weighted round robin
- Round robin where bigger servers appear more often in the rotation and so get more requests.
- Whiteboard sketch
- A first design drawn as boxes for components and arrows for the messages between them. A wrong box costs an eraser; a wrong server costs months.
- Write-through cache
- A cache that is written together with the database at the same time, instead of deleting the cached key.
X
- xUnit
- A widely used C# testing framework for writing and running automated tests in real projects. It needs a package, so small standalone examples use a tiny `Check` helper that throws on failure instead.