Glossary
163 terms from Microservices, in plain words, each with the chapter that teaches it.
#
- 4xx / 5xx
- Families of HTTP status codes. 4xx means the caller's request was at fault, so retrying won't help. 5xx means the service failed, so a retry may work.
- @app.before_request / @app.after_request
- Flask decorators that register a function to run before every route, or after every route with the reply in hand. Kettle & Crane's `obs.py` uses them to start a timer and write one log line per request.
A
- alert
- An automatic notification sent when a metric crosses a threshold. Tools such as Grafana can send alerts based on metrics collected by Prometheus.
- anti-corruption layer
- A translation step at the edge of a new service that converts the monolith's old names and formats into the new design. It keeps old naming, like `item_code`, from leaking in.
- API (Application Programming Interface)
- The set of routes and messages a service offers so that other programs can use it. Inventory's API is the only way other services reach its stock data.
- API composition
- Building one answer by asking several services and merging their replies in code. Orders does this for Sam's report by fetching each SKU's stock from inventory.
- API contract
- Everything callers rely on from a service: its URLs, fields and status codes. Changing the contract can break other teams, so changes need care.
- API gateway
- One front door that all outside requests pass through. It routes each request to the right service and handles shared jobs like rate limiting and checking users.
- API versioning
- Putting a version in the path, such as `/v1/stock`, so a breaking change can ship as `/v2/` beside the old one. Callers move when they're ready.
- asynchronous messages
- A style where the sender puts a message on a queue and carries on without waiting for a reply, like leaving a voicemail. It keeps working while the receiver is down.
- at-least-once delivery
- A guarantee that an event is delivered one or more times, never zero. The outbox relay can resend an event after a crash, so subscribers must tolerate duplicates.
B
- backend for frontend
- A separate gateway for each kind of client, so, for example, the mobile app gets replies shaped for small screens.
- backward-compatible
- A change that keeps every existing caller working, such as adding a new reply field or endpoint. Renaming or removing a field is not backward-compatible.
- bounded context
- An area of the business where a word has one clear meaning. "Product" means price to catalog, shelf count to inventory and weight to shipping, so each service keeps its own model.
- branch by abstraction
- Hiding old code behind one function with two versions and a one-line switch between them. Kettle & Crane's `take_stock` switches between local and service versions.
- broker
- A system such as Kafka, RabbitMQ or a cloud queue service that carries events from publishers to subscribers.
- bulkhead
- A limit on how many threads may wait on one service at once, so a slow service can't use them all. Named after the walls in a ship's hull.
- business capability
- Something the business does, such as keeping stock or taking payment. Services should be split along capabilities, not technical layers.
C
- call_with_retry
- A helper function in `resilience.py` that calls a service and retries connection errors, timeouts and 5xx replies, waiting longer after each failed attempt (exponential backoff). Replies below 500, such as a 409, are returned immediately.
- cascading failure
- A failure that spreads: a slow service ties up callers' threads, which then slow their callers, until the whole shop stops.
- change data capture
- Reading a database's change log and sending each change on as an event. It keeps a copy in sync more safely than dual writes.
- choreography
- A way to run a saga where each service reacts to events and publishes its own. There's no central controller, so the process is spread out and harder to follow.
- CI/CD (continuous integration and delivery)
- Automatically testing and deploying every change. It's a prerequisite for running many services.
- circuit breaker
- A wrapper around a call that opens after several failures in a row and goes straight to a fallback. After a pause it lets one trial call through and closes if that works.
- client-side discovery
- A form of service discovery where the caller asks the registry for addresses and picks one itself.
- cohesion
- How well the things inside one service belong together. A service with one job and one reason to change has high cohesion.
- command
- A request asking a service to do something, like "reserve 2 mugs". Unlike an event, it can be refused.
- compensating action
- A new step that undoes the effect of an earlier, already committed step, such as releasing stock to undo a reservation or refunding a charge.
- Compose (Docker Compose)
- A Docker tool that runs several containers together on one network, where each service's name works as its host name.
- Consul
- A well-known service registry that keeps the list of running service addresses.
- consumer-driven contract
- A test written from what a calling service (the consumer) relies on, run by the called service's team. If inventory renames `qty`, it fails before the change ships.
- coupling
- How much one part depends on another. Services should be loosely coupled, so each can change its insides as long as its API stays the same.
- CQRS (Command Query Responsibility Segregation)
- A design that uses separate models for writing data (commands) and for reading it (queries), so each side can be shaped for its own job.
- curl
- A command-line tool for sending HTTP requests. `-H` adds a header, `-s` hides progress output and `--json` sends a JSON body.
- cut-over
- The moment a migration switches ownership, so the monolith stops touching the data and the new service becomes its only owner.
D
- data warehouse
- A separate database built for analysis, fed with copies of every service's data so big reports never slow down the services.
- database per service
- The rule that each service has its own database and only that service reads or writes it. Other services get the data through its API or its events.
- Debezium
- A tool that implements change data capture by reading a database's change log and sending each change on as an event.
- Deployment (Kubernetes)
- A Kubernetes object that keeps your pods running, replacing them when needed. Each replacement pod can have a new address.
- development server
- Flask's built-in server, meant for trying things out. In production you'd run the app with a server such as Gunicorn.
- digest
- A short fixed-size fingerprint made by hashing data. Orders stores a digest of each request body to spot an Idempotency-Key reused for a different order.
- distributed monolith
- Services split into processes that still have to change and deploy together. You pay all the network costs and get no benefits.
- distributed tracing
- Recording one request's path through every service with timings, so you can see where the time went.
- DNS (Domain Name System)
- The system that turns names into addresses. Compose's DNS lets the gateway reach inventory at `http://inventory:8001`.
- domain
- The business area a program serves.
- domain-driven design
- An approach to modeling software on the business. It uses bounded contexts to mark where each word has one clear meaning.
- dual-write problem
- The risk of writing to two places, such as a database and a broker, without one transaction. A crash between the writes leaves them out of agreement.
E
- end-to-end test
- A test that starts real services as processes and checks them working together. It catches wiring mistakes but is slow and can be flaky.
- endpoint
- One URL and method a service answers, such as the endpoint that reserves stock.
- environment variable
- A named setting provided outside the code, read with `os.environ.get`. Services use them to learn each other's URLs.
- event
- A statement of a fact that has already happened, named in the past tense, such as `OrderPlaced`. It can be ignored but not refused.
- event sourcing
- A design that stores every event that happened and works out the current state by replaying them, instead of storing only the latest state.
- event storming
- A workshop where people write each business event on a sticky note in past tense and group them in time order. The groups reveal where service boundaries belong.
- eventual consistency
- Copies of data may lag briefly but end up agreeing. A read-only copy updated from events works this way.
- exponential backoff
- Waiting longer after each failed attempt before retrying, such as 0.1 s then 0.2 s.
F
- fallacies of distributed computing
- A well-known list of false assumptions programmers make about networks, such as "the network is reliable" and "latency is zero".
- fallback
- A useful substitute answer given when a call fails, such as showing the last known stock count marked as possibly out of date.
- fault isolation
- A benefit of services: if one, like email, crashes, the others keep working, and customers can still order.
- feature flag
- A setting that turns new code on or off without a deploy. It can send 5% of requests to a new service first, then 50%, then all.
- flaky test
- A test that sometimes fails for reasons unrelated to your change, such as a slow start.
- Flask
- A small Python web framework for building web services by attaching functions to routes, such as `@app.get("/price/<sku>")`. A function that returns a dict sends it as JSON.
- flask.g
- An object Flask gives each request for storing values that last until that request ends, such as its request ID.
G
- Gateway API
- The newer Kubernetes way, replacing Ingress, to route outside traffic into a cluster.
- Grafana
- A free tool that draws dashboards and sends alerts from metrics collected by Prometheus.
- gRPC
- A framework where services call each other's functions over HTTP, using Protocol Buffers. It's fast and its schemas make contracts explicit, but you can't test it with `curl`.
- Gunicorn
- A production-grade Python web server for running Flask apps instead of the development server.
H
- half-open
- The circuit breaker state after its pause, when it lets one trial call through. Success closes the breaker and failure opens it again.
- health check
- A small route, such as `/health`, that returns a status showing whether a service is working.
- heartbeat
- A regular signal a service copy sends to the registry to show it's still alive. The registry drops copies that stop.
- Host addresses (127.0.0.1, 0.0.0.0)
- 127.0.0.1 (localhost) means "this computer", which is where Flask's development server listens by default. 0.0.0.0 means "listen on all network interfaces", which services in containers need (`--host 0.0.0.0`) so other containers can connect.
- HTTP header
- A named piece of information sent along with a request or reply, such as `X-Request-ID` or `Idempotency-Key`.
- HTTP method
- The verb of a request. GET reads, POST creates or changes something, and DELETE removes something.
- HTTPS (TLS)
- HTTP encrypted with TLS. The gateway is a natural place to handle it.
I
- Idempotency-Key
- A unique value, sent as a header or taken from the order ID, that lets a service recognize a retried request and avoid doing the work twice.
- idempotent
- Safe to repeat: doing it twice has the same effect as once. Inventory's reservation endpoint is idempotent, so a retry takes the two mugs only once.
- idempotent consumer
- A subscriber that records the event IDs it has handled and skips repeats, so duplicate delivery does no harm.
- Ingress
- The older Kubernetes way to route outside traffic into a cluster, now succeeded by the Gateway API.
- Istio / Linkerd
- Service meshes that add encryption and other call handling between services outside your code.
J
- Jaeger / Grafana Tempo
- Trace viewers that receive spans and draw each request's journey as nested bars.
- jitter
- A random amount added to retry waits so many callers don't all retry at the same moment.
- JSON (JavaScript Object Notation)
- A text format for structured data, like Python dicts. It's the usual message format between services.
- JWT (JSON Web Token)
- A small signed piece of JSON saying who the caller is. The receiver checks the signature and rejects a bad or missing token with 401.
K
- Kafka / RabbitMQ
- Brokers that carry events between services in production.
- Kong / Envoy / nginx
- Off-the-shelf software that can act as an API gateway.
L
- latency
- The time a call takes to get an answer. A network call has far more latency than a function call.
- liveness probe
- A Kubernetes check asking "are you stuck?" If it fails a few times, Kubernetes restarts the container. It should check only the process, not the database.
- load balancer
- A component that spreads requests across several copies of a service. Running the gateway behind one keeps it from being a single point of failure.
- load shedding
- An overloaded service quickly refusing some requests, with 429 or 503, instead of answering all of them slowly.
- logs
- A record with one line per event. Logs answer "what happened to this request?"
M
- metrics
- Numbers over time, such as requests per second, that show whether a service is healthy right now. Services serve them at a `/metrics` endpoint.
- microservice
- A small program that does one business job. It has its own process, its own data, independent deployment and one owning team.
- modular monolith
- One program with clear walls between modules, used only through a few public functions. It's often enough, and many teams never need more.
- monolith
- One program that does every job and is deployed as one unit. Kettle & Crane's shop is one.
- mTLS (mutual TLS)
- Both sides of a connection prove who they are with certificates, and the traffic is encrypted. A service mesh can add this for you.
N
- N+1 problem
- Making one query for N rows and then N more network calls, one per row. With 5,000 orders it means 5,000 calls.
- nanoservice
- A service so small, such as one function or one table, that its network calls cost more than it gives.
O
- observability
- How well you can tell what a running system is doing from what it reports. It rests on logs, metrics and traces.
- OpenTelemetry
- An open standard with libraries that record spans automatically for Flask and `requests` calls. It passes the trace along in the `traceparent` header.
- orchestration
- A way to run a saga where one service calls each step in turn. Orders orchestrates checkout, keeping the process and undo rules in one place.
- order states
- The five states an order moves through: PENDING (saga running), CONFIRMED (stock reserved and card charged), REJECTED (no stock), CANCELED (card declined) and FAILED (a service didn't answer).
- outbox
- A table in a service's own database where events are saved in the same transaction as the data, to be published later.
P
- Pact
- A tool that records contracts from the consumer's tests and checks them against the service automatically.
- parallel run
- Sending the same questions to old and new code and reporting any difference, before customers depend on the new service.
- percentile (p99)
- The time that 99 out of 100 requests beat. It reveals the slow tail that an average hides.
- pod
- The unit Kubernetes runs, holding one or more containers. A pod can be replaced at a new address.
- port
- A number after the host name, such as 8001, that picks which program on a computer receives a network request. Each Kettle & Crane service runs on its own port so several can run side by side on one machine.
- probe
- A check Kubernetes runs against a container. Liveness and readiness are the two kinds.
- Prometheus
- A popular metrics database that collects numbers from every service's `/metrics` endpoint every few seconds.
- Protocol Buffers
- A compact binary message format defined in a schema file, used by gRPC.
- publisher / subscriber (pub/sub)
- The publisher sends an event; subscribers receive it. Orders publishes `OrderPlaced` without knowing who listens.
- pytest
- A Python testing tool that runs functions starting with `test_` and checks their `assert` statements.
R
- rate limiting
- Refusing a caller who sends too many requests per minute. The gateway is a natural place to do it.
- read-only copy
- A copy of another service's data kept by a reading service and updated from the owner's events. It may lag a little behind.
- readiness probe
- A Kubernetes check asking "can you take requests now?" If it fails, the pod gets no traffic until it passes, for example while its database is unreachable.
- RED method
- Watching three numbers per service: rate (requests per second), errors and duration.
- relay
- A loop that publishes unsent events from the outbox and marks them sent. It may resend after a crash.
- request ID
- A short random ID given to a request on arrival and passed to every service in the `X-Request-ID` header. Searching the logs for it shows one request's whole story.
- requests (library)
- A Python HTTP client library used by services to call each other, with options like `json=`, `headers=` and `timeout=`.
- reservation
- Taking stock off the shelf for an order so no one else can buy it. Inventory keys each reservation by order ID, and a release puts the stock back.
- retry amplification
- Retries in several layers multiplying: three layers each trying 3 times turn one failure into 27 attempts, hitting a struggling service hardest.
- Retry-After
- An HTTP header telling a caller how many seconds to wait before trying again.
- rollback
- Switching a route back to the monolith if the new service misbehaves, which is one setting while the monolith still has current data.
- route
- A URL pattern a Flask app answers, such as `/v1/stock/<sku>`, tied to a function.
- routing
- Sending each request to the right service, usually by path prefix: `/v1/stock` to inventory, `/v1/orders` to orders.
S
- saga
- A series of local steps across services, each committed on its own. If a step fails, the finished steps' compensating actions run, newest first.
- semaphore
- A counter of free slots. `threading.BoundedSemaphore(2)` allows two holders at once, which is how the bulkhead limits calls.
- server-side discovery
- A form of service discovery where the caller sends every request to a load balancer, which asks the registry for the address.
- Service (Kubernetes)
- A Kubernetes object giving a set of pods one stable name and spreading requests across them.
- service discovery
- How a caller finds the current address of the service it needs, by configuration, a registry or DNS names.
- service mesh
- Infrastructure that handles calls between services, including encryption, outside your code. Istio and Linkerd are examples.
- service registry
- A list of running service addresses. Each copy registers when it starts and sends heartbeats, and the registry drops copies that stop.
- service test
- A test that runs one service through its API with no network, using Flask's test client. It catches wrong routes, status codes and replies.
- shadow traffic
- Copying live requests to a new service and throwing its replies away, to compare it with the old code safely.
- single point of failure
- One component whose failure stops the whole system. Because every request passes through the gateway, it is run as several copies behind a load balancer.
- SKU (stock-keeping unit)
- A product's code, such as `MUG-BLUE`. It's the one thing the services share about a product.
- snapshot
- A copy of a value as it was at one moment. Orders saves the $18 price with an order so it stays correct even if catalog later raises the price.
- span
- One timed piece of a trace, such as "orders calls payments". It has a start time, a duration and the span that started it.
- SQLite
- A database built into Python's standard library that needs no separate server and can store data in a file or in memory. It is handy for giving a small service its own private data.
- strangler fig
- A migration approach, named after a vine that grows around a tree. You put a gateway in front of the monolith and move one capability at a time to new services.
- structured log
- A log line written as a JSON object, so a program can filter and count lines by field, such as `"status": 500`.
- subprocess.Popen
- A Python function that starts a program as a separate process and returns at once. Tests use it to launch real services.
- synchronous call
- A request where the caller sends it and waits for the reply, like a phone call. Use it when the caller can't continue without the answer.
T
- team autonomy
- A benefit of services: each team changes its own service and data without asking the others.
- tenacity / pybreaker
- Python libraries for production code: tenacity handles retrying failed calls and pybreaker provides circuit breakers. They replace hand-written versions of these patterns.
- test pyramid
- A picture recommending many fast tests, unit and service, at the base and few slow end-to-end tests at the top.
- test_client
- Flask's tool for sending requests straight into an app with no server or network, so service tests run in milliseconds.
- thread
- A path of execution inside one process; a service typically uses one thread per request it is handling. A slow call that holds a thread can use up all the threads and freeze the service.
- timeout
- A limit on how long a call may wait for an answer. Without one, `requests` waits forever and a hanging service freezes its callers.
- timeout budget
- Setting timeouts from the outside in so inner calls, retries included, fit inside the outer caller's limit. Orders' worst case of 4.2 s fits the gateway's 5 s.
- tmp_path_factory.mktemp
- A pytest helper that makes a new empty temporary folder for a whole test file. Orders' tests use it for a fresh database.
- tolerant reader
- A caller that reads only the fields it needs and ignores the rest, so new fields never break it.
- trace
- The whole journey of one request through every service, made of spans with timings.
- traceparent
- The W3C header that OpenTelemetry uses to pass a trace between services, like `X-Request-ID`.
- transaction
- A group of database changes that all happen or none do. There's no shared transaction across services.
- transactional outbox
- A fix for the dual-write problem: orders writes the event into an outbox table in the same transaction as the order, and a relay publishes it later.
- two-phase commit
- A protocol for transactions across databases: a coordinator asks all to get ready and lock rows, then tells them to commit. Microservices avoid it because it's slow and can leave rows locked.
U
- URL variable
- A part of a route written in angle brackets, like `<sku>`, which Flask passes to the function as an argument. `<path:path>` can also match slashes.
- UUID
- A long random ID that is practically never repeated. Here, 8 characters of one serve as a request ID.
V
- virtual environment
- An isolated Python setup where you can install packages without affecting the rest of your computer or other projects.
W
- WSGI server
- A production-grade server that runs Python web apps. Flask warns you to use one instead of its development server.
X
- X-Request-ID
- An HTTP header that carries a request's ID from one service to the next. Because every service logs the same ID, you can search all the logs and see one request's whole path.
- X-User-Id
- A header the gateway sets after checking a login. It must strip any such header from outside requests so no one can fake it.
Y
- yield fixture
- A pytest setup function whose code before `yield` runs before the tests and whose code after runs when they're done. `scope="module"` runs it once per file.