Skip to content
Prompt Words
History Member

System design

How big systems fit together.

0 of 52 learned

Scaling 0 / 6

Handling more users and more data.

Cache-aside

Also called: lazy loading, look-aside cache, lazy caching.

Read a product twice: the first read misses the cache and goes to the database, the second is served from Redis.

Cache hits: 0 · Database reads: 0

Nothing read yet. The cache starts empty.

    Hits 0 misses 0

    The app reads from a cache such as Redis first; on a miss it reads the database, stores the result in the cache and returns it. On a write it updates the database and then deletes the cached key, so the next read loads fresh data. The cache only ever holds data someone asked for.

    Say it in a prompt

    Add a cache-aside layer with Redis for GET /products/:id: read the key product:{id} first; on a miss, load the row from Postgres, store it with a 300-second TTL and return it. On update or delete, write to Postgres first, then delete the key. If Redis is down, read straight from Postgres.

    Vague vs precise prompt

    Vague prompt

    make the product page faster when lots of people open it

    Typical resultAdds an in-memory Map inside one server with no expiry. The other servers still hit the database, and edits don't show until a restart.

    Precise prompt

    Add cache-aside with Redis for GET /products/:id: read product:{id} first; on a miss load it from Postgres, cache it for 300s (TTL) and return it. On update, write Postgres, then delete the key.

    Typical resultRepeat reads skip Postgres, the database sees at most one query per product every 5 minutes plus one after each edit, and an edit shows on the next read.

    Seen on

    • Azure Architecture Center: Documents the Cache-Aside pattern: try the cache, load from the data store on a miss and add the item to the cache, and invalidate the cached item when the data changes.
    • Amazon ElastiCache: Calls the same strategy lazy loading: data goes into the cache only when it is requested, and adding a TTL keeps it from getting too stale.

    You might describe it as

    • check Redis first, then the database
    • only cache what people actually ask for
    • keep a copy of hot rows so the database gets fewer reads

    Not to be confused with

    • TTL (time to live)

      Cache-aside decides when data goes into the cache (on a miss); a TTL decides when it drops out.

    • CDN

      Cache-aside is a cache your app code fills from the database; a CDN caches whole HTTP responses on servers near the user.

    • Memoization

      Cache-aside keeps shared data in a cache like Redis that every server reads, with a TTL; memoization remembers one function's answers inside one running program.

    • Cache stampede

      Cache-aside is the everyday read, miss and fill routine; a cache stampede is that routine overloading the database when many requests miss the same hot key at once.

    CDN

    Also called: content delivery network, edge cache, edge network.

    Users in Tokyo open a page with an image, one after another. The first one misses: the Tokyo edge fetches the image from the origin in Virginia. Everyone after that gets the edge's copy.

    Edge hits: 0 · Trips to the origin: 0

    Nothing loaded yet. The edge server in Tokyo has no copy of the image.

      V1 edge empty hits 0 misses 0

      A network of servers around the world that keeps cached copies of your files and responses close to users. Each request goes to a nearby edge server, and only a miss travels on to your own server (the origin). Cache-Control headers decide what it caches and for how long.

      Say it in a prompt

      Serve /assets/* through a CDN: put a content hash in every file name (app.3f9a1c.js) and send Cache-Control: public, max-age=31536000, immutable. For HTML pages send Cache-Control: public, max-age=0, s-maxage=60, stale-while-revalidate=300, and purge the HTML paths on every deploy.

      Vague vs precise prompt

      Vague prompt

      the site is slow for users in Asia, fix it

      Typical resultCompresses the images and minifies the JavaScript, but every request still crosses the ocean to one server in Virginia.

      Precise prompt

      Put /assets/* behind a CDN with hashed file names and Cache-Control: public, max-age=31536000, immutable. Give HTML Cache-Control: public, max-age=0, s-maxage=60, stale-while-revalidate=300, and purge the HTML paths on deploy.

      Typical resultScripts, styles and images come from an edge server near each user. Browsers ask the edge again for HTML; the edge refreshes its copy in the background after a minute and drops it on every deploy. The origin sees far fewer requests.

      Seen on

      • Cloudflare: Caches static files such as images, CSS and JavaScript by default, but not HTML or JSON, and follows the Cache-Control headers from your origin.
      • Amazon CloudFront: Routes each request to the edge location with the lowest latency; if the file isn't cached there, it fetches it from your origin.

      You might describe it as

      • put the images on servers closer to the users
      • the site loads slowly for people in other countries
      • serve static files from the edge

      Not to be confused with

      • Cache-aside

        A CDN caches whole HTTP responses near the user; cache-aside is your app caching database results next to the database.

      • Load balancer

        A CDN answers from its own cache when it can; a load balancer always passes the request on to one of your servers.

      • Signed URL

        A CDN keeps copies of files near users to make them fast; a signed URL is a short-lived permission to fetch one private file, and a CDN can be the one that checks it.

      Load balancer

      Also called: LB, application load balancer, ALB.

      The balancer hands requests to the 3 servers in turn: 1, 2, 3, then 1 again (round robin). Take server 2 down to see health checks find it and take it out.

      Server 1: 0 · Server 2: 0 · Server 3: 0 · Failed: 0 · Balancer sends to: 1, 2, 3

      No requests yet. All 3 servers are healthy.

        Served 0 0 0 failed 0 healthy 1 2 3

        A server in front of several copies of your app that passes each request to one of them, using a rule such as round robin or least connections. It health-checks each copy, for example GET /ready, and stops sending traffic to a copy that fails.

        Say it in a prompt

        Put an application load balancer in front of 3 app instances with round-robin routing. Health-check GET /ready (200 only when the instance can serve requests) every 10 seconds; take an instance out after 2 failures in a row and put it back after 3 passes. Keep the app stateless: store sessions in Redis, not in server memory.

        Vague vs precise prompt

        Vague prompt

        we have more users now, make the server handle it

        Typical resultRaises the worker or thread count on the one server. When that server goes down, the whole site goes down with it.

        Precise prompt

        Run 3 app instances behind an application load balancer with round-robin routing. Health-check GET /ready every 10 s; remove after 2 failures, re-add after 3 passes. Move sessions to Redis so any instance can serve any user.

        Typical resultTraffic splits across 3 instances, a crashed instance stops getting requests within about 20 seconds, and users stay logged in whichever instance answers.

        Seen on

        • NGINX: Its upstream module spreads requests round-robin by default, with least-connected and ip-hash as options, and marks a server as failed after max_fails failed attempts.
        • AWS Application Load Balancer: Sends health-check requests to every target and routes only to healthy ones; by default a target is taken out after 2 failed checks in a row.

        You might describe it as

        • spread the traffic over several servers
        • one address in front of many app copies
        • stop sending users to the server that crashed

        Not to be confused with

        • CDN

          A load balancer forwards every request to one of your servers; a CDN answers from its own cached copy when it can and only asks your server on a miss.

        • Horizontal scaling

          A load balancer spreads requests across the copies you have; horizontal scaling is adding those copies.

        • Health check

          A load balancer spreads requests over the copies of your app; a health check decides which copies may get them.

        • API gateway

          A load balancer's main job is spreading requests over healthy copies of a service, and many can also route by path; per-client keys, tokens and rate limits are what an API gateway adds.

        Read replica

        Also called: replica, read-only replica, secondary, follower.

        Writes go to the primary; the replicas copy each change 2 s later (slow on purpose). A read in that gap gets old data.

        Writes: 0 · Reads: 0 (0 stale) · Replicas are up to date

        The primary and both replicas have price $10.

          Writes 0 reads 0 stale 0

          A read-only copy of a database that the primary keeps updated, usually asynchronously. You send heavy reads such as listings and reports to it, so the primary has room for writes. Because copying takes time, a replica can be a little behind the primary (replica lag).

          Say it in a prompt

          Add a Postgres read replica and route read-only queries (search, product listings, admin reports) to it through a second connection pool. Keep all writes on the primary. For read-your-writes, send a user's reads to the primary for 10 seconds after they write, so the page that loads right after saving shows the change. Alert when replica lag goes over 5 seconds.

          Vague vs precise prompt

          Vague prompt

          the database is slow, make it handle more traffic

          Typical resultSuggests a bigger database server or adds indexes here and there. Reads and writes still compete on one machine.

          Precise prompt

          Add a Postgres read replica. Send read-only queries (search, listings, admin reports) to it through a separate pool. Keep writes on the primary, and for 10s after a user writes, send that user's reads to the primary too (read-your-writes). Alert if replica lag passes 5s.

          Typical resultReports and listings move off the primary, writes get its full capacity, and a user who just saved still sees their change because that read goes to the primary.

          Seen on

          • Amazon RDS: A read replica is a read-only copy of a DB instance. RDS copies the primary's updates to it asynchronously, and you route read queries to it to take load off the primary.
          • A reporting dashboard runs its slow queries against a replica, so checkout writes on the primary stay fast.

          You might describe it as

          • a second copy of the database just for reading
          • send the heavy report queries somewhere else
          • database that follows the main one

          Not to be confused with

          • Sharding

            A read replica is a full copy of the data that only serves reads; sharding splits the data so each database holds a different part, which spreads writes too.

          • Database index

            A read replica adds a copy of the database so more reads can run at once; an index helps one database find rows faster.

          • Read model

            A read replica copies every table of the primary for you, so heavy reads move off it without changing the queries; a read model is a table someone designs for one screen.

          • Eventual consistency

            A read replica is one copy you can read from; eventual consistency is the rule that says what copies like it may show, old data for a while and the same data once writes stop.

          Sharding

          Also called: horizontal partitioning, partitioning, shards.

          hash(user_id) % 6 picks a logical shard, and a lookup table says which database (shard) holds it.

          Shard 0: 3 users · Shard 1: 3 users · Shard 2: 3 users

          9 users on 3 shards, placed by hash(user_id) % 6 and a lookup table.

            Rows 3 3 3

            Splitting one big dataset across several databases by a shard key, so each database (a shard) holds only its part. All reads and writes for one key go to one shard, which spreads both the data and the write load. Queries that need many shards get slower and harder to write.

            Say it in a prompt

            Shard the orders table by tenant_id: logical_shard = hash(tenant_id) % 64, and a lookup table maps the 64 logical shards onto 8 Postgres databases. Every query must include tenant_id and go through one shard-router module. Moving a shard means copying it and updating the lookup table, with no rehashing.

            Vague vs precise prompt

            Vague prompt

            our orders table is huge, split it up so it scales

            Typical resultCreates orders_2024 and orders_2025 tables on the same server. The disk and the write load stay on one machine.

            Precise prompt

            Shard orders by tenant_id: logical_shard = hash(tenant_id) % 64, with a lookup table mapping the 64 logical shards onto 8 Postgres databases. All queries include tenant_id and go through one shard-router module.

            Typical resultEach database holds about an eighth of the tenants and their writes, one tenant's queries touch one database, and a shard can be moved by editing the lookup table.

            Seen on

            • Notion: Split its Postgres data into 480 logical shards spread over 32 physical databases, with the workspace ID as the shard key.
            • MongoDB: A sharded cluster spreads a collection's documents across shards by a shard key, and the mongos router sends each query to the right shard.

            You might describe it as

            • split the customers across several databases
            • each database only holds some of the users
            • one table is too big for one server

            Not to be confused with

            • Read replica

              Sharding gives each database a different slice of the data; a read replica is a full copy that only serves reads.

            • Data residency

              Sharding splits data to spread the load; data residency splits it by where the law or a contract says it may live. Residency is often built with sharding, using the home region as the shard key.

            TTL (time to live)

            Also called: time to live, expiry, expiration time, max-age.

            The key lives 10 s here (the prompt uses 300). Until then, reads come from Redis, even if Postgres changed.

            product:1 is not in Redis · Cache hits: 0 · Database reads: 0

            Redis is empty. Read the key to load it from Postgres.

              Empty

              A lifetime in seconds attached to a cached value, a DNS record or a message; when it runs out, the copy is deleted or treated as missing. A short TTL means fresher data and more load on the source; a long TTL means less load and staler data.

              Say it in a prompt

              Set a TTL on every cache write: 300 seconds for product pages, 30 seconds for stock counts, 24 hours for the country list. Add ±10% random jitter to each TTL so keys written together don't all expire in the same second, and delete a key right away when its row changes.

              Vague vs precise prompt

              Vague prompt

              make sure the cache doesn't show old data

              Typical resultClears the whole cache whenever anything changes, or turns caching off for that page, so the database load comes straight back.

              Precise prompt

              Give each cache entry a TTL: 300s for product pages, 30s for stock counts. Add ±10% jitter so keys don't expire together, and delete a key as soon as its row is updated.

              Typical resultStock is never more than 30 seconds old and product pages at most 5 minutes, and expiries spread out instead of hitting the database all at once.

              Seen on

              • Redis: EXPIRE key seconds sets a timeout, after which the key is deleted automatically; the TTL command shows how many seconds are left.
              • Cloudflare DNS: Every DNS record has a TTL that controls how long it is cached; the Auto setting is 300 seconds.
              • Amazon CloudFront: By default a file stays in an edge location for 24 hours before it expires, unless the origin's headers say otherwise.

              You might describe it as

              • how long before the saved copy counts as old
              • auto-delete the cached value after a while
              • expire the key after five minutes

              Not to be confused with

              • Cache-aside

                A TTL is only the expiry timer on an entry; cache-aside is the whole read, miss, load and store routine that usually sets one.

              • Cache stampede

                A TTL is the timer that makes a key expire; a cache stampede is the rush of reloads when a busy key expires and many requests miss it together.

              Messaging 0 / 5

              Passing work between services.

              Backpressure

              Also called: back pressure, flow control.

              The producer reads a CSV file at 10 rows a second, the consumer inserts 2 rows a second. Import with backpressure off, then turn it on and import again.

              In the buffer: 0 · Inserted: 0 · Peak: 0

              Nothing imported yet. Backpressure is off.

                Idle bp off peak 0

                A way for a slow consumer to make a fast producer slow down, instead of letting work pile up until memory runs out. The consumer only accepts what it can handle, and the producer waits, keeps a bounded buffer or drops the extra.

                Say it in a prompt

                Add backpressure to the CSV import: read rows as a stream into a bounded buffer of 1,000 rows, pause reading while the buffer is full and resume when it drains below 500. Insert in batches of 200 with at most 4 inserts in flight.

                Vague vs precise prompt

                Vague prompt

                read the CSV as a stream so the import stops crashing

                Typical resultReads the file as a stream but passes each row on without waiting. It reads 10,000 rows a second and the database saves 2,000, so unsaved rows pile up in memory and a big file still crashes it.

                Precise prompt

                Stream the CSV with backpressure: a bounded buffer of 1,000 rows, pause reading when it is full, resume below 500. Insert in batches of 200 with at most 4 in flight.

                Typical resultMemory stays flat whatever the file size, reading pauses whenever the database falls behind, and a 10 GB file imports like a small one, only slower.

                Seen on

                • Node.js: Its streams guide explains backpressure: write() returns false once the buffer passes highWaterMark (16 KB by default), and the source should wait for the 'drain' event.
                • Reactive Streams: A standard for asynchronous stream processing with non-blocking back pressure, so the queues between threads can stay bounded.

                You might describe it as

                • the reader is faster than the database can save
                • slow down the sender when the receiver can't keep up
                • work piles up faster than we can process it

                Not to be confused with

                • Rate limiting

                  Backpressure slows the sender down based on how busy the receiver is right now; rate limiting is a fixed allowance per client, and extra requests are refused.

                • Connection pool

                  Backpressure is the slow side telling the fast side to slow down; a connection pool caps how many requests can use the database at the same time.

                • Streaming results

                  Backpressure makes a fast producer wait for a slow consumer; streaming results reads big data in small pieces so memory stays small. A stream with no backpressure can still fill memory, because rows read fast pile up before the slow side handles them.

                Dead-letter queue

                Also called: DLQ, dead letter exchange, poison message queue.

                Send a few emails and one bad one. The bad one fails 3 times, then moves to the dead-letter queue, so it stops looping and the others keep going. The prompt says 5 tries; the demo uses 3 to keep it short.

                Sent: 0 · In the queue: 0 · In the DLQ: 0

                The queue is empty. Each message gets up to 3 tries (maxReceiveCount 3).

                  Sent 0 dlq 0

                  A side queue where a message goes after it has failed a set number of times, so one broken message stops looping in the main queue. You inspect it, fix the bug and send it back (redrive).

                  Say it in a prompt

                  Give the emails queue a dead-letter queue: after 5 failed receives (maxReceiveCount 5), move the message to emails-dlq. Keep DLQ messages for 14 days, alert as soon as the DLQ is not empty, and add an admin command that redrives its messages to the main queue after a fix.

                  Vague vs precise prompt

                  Vague prompt

                  some jobs fail and retry forever, stop that

                  Typical resultWraps the handler in try/catch and quietly drops the job on any error. The failed emails are gone and nobody knows.

                  Precise prompt

                  Add a dead-letter queue: after 5 failed receives (maxReceiveCount 5), move the message to emails-dlq. Keep it 14 days, alert when the DLQ is not empty, and add a command to redrive messages after a fix.

                  Typical resultA broken message stops after 5 tries instead of looping, nothing is lost, someone gets alerted, and the fixed messages replay with one command.

                  Seen on

                  • Amazon SQS: A redrive policy's maxReceiveCount sets how many times a message can be received before SQS moves it to the dead-letter queue; redrive moves messages back out.
                  • RabbitMQ: Dead-letters a message that is rejected without requeue, expires by TTL, overflows the queue's length limit, or passes a quorum queue's delivery limit.

                  You might describe it as

                  • a bad message keeps crashing the worker over and over
                  • put the failed jobs aside to look at later
                  • where messages go after too many retries

                  Not to be confused with

                  • Queue

                    The dead-letter queue only receives messages that failed too many times; the main queue holds the normal work.

                  Fan-out

                  Also called: fanout, fan-out on write, scatter.

                  When Ana posts, the API saves it once and answers her. A background worker then writes the post into each follower's feed. More followers means more writes, but opening a feed stays one quick read.

                  Followers: 4 · No posts yet

                  Ana hasn't posted yet. Each follower has an empty feed.

                    Posts 0 writes 0 followers 4

                    Sending one incoming message or request out to many receivers at once. Fan-out on write copies a new post into every follower's feed when it is created, so reading a feed later is one quick lookup.

                    Say it in a prompt

                    When a user posts, fan out on write: a background worker pushes the post ID onto each follower's Redis list feed:{followerId} and trims it to the newest 800. For accounts with more than 10,000 followers, skip the fan-out and merge their latest posts in at read time.

                    Vague vs precise prompt

                    Vague prompt

                    build a home feed that shows posts from people I follow

                    Typical resultRuns one big query joining follows and posts on every page load, and the feed gets slower with every user who signs up.

                    Precise prompt

                    Fan out on write: when a user posts, a worker pushes the post ID to feed:{followerId} in Redis for each follower (trim to 800). For accounts with over 10,000 followers, skip fan-out and merge their posts at read time.

                    Typical resultOpening the feed is one Redis read, posting costs one write per follower in the background, and a celebrity post doesn't trigger millions of writes.

                    Seen on

                    • Amazon SNS: In its fanout scenario, a message published to a topic is copied to many endpoints, such as several SQS queues, for parallel processing.
                    • Twitter: Its Timelines at Scale talk, summarized by High Scalability, describes a fanout service inserting each new tweet ID into every follower's home timeline list in Redis, capped at 800 entries.

                    You might describe it as

                    • copy the new post into every follower's feed
                    • one event goes out to many places at once
                    • send the same message to all the queues

                    Not to be confused with

                    • Pub/sub

                      Fan-out is the copying of one message to many receivers; pub/sub is a messaging setup that does that copying through a topic.

                    Pub/sub

                    Also called: publish/subscribe, topic, event bus.

                    Checkout sends each event once, to a topic, and doesn't know who listens. Every subscriber gets its own copy in its own queue, so one that is down only falls behind.

                    Events published: 0 · Copies delivered: 0

                    3 services subscribe to order.placed. Nothing published yet.

                      Published 0 subscribers 3

                      A publisher sends an event to a topic without knowing who listens, and every subscriber to that topic gets its own copy. You can add a new consumer without changing the publisher.

                      Say it in a prompt

                      When an order is placed, publish an order.placed event with {orderId, userId, total} to a topic. Subscribe three services: email sends the receipt, inventory reserves stock, analytics records the sale. Each subscriber gets its own queue and retries on its own, and ignores an orderId it has already handled.

                      Vague vs precise prompt

                      Vague prompt

                      after an order, send an email and update the stock and analytics

                      Typical resultCalls the three services one after another inside the checkout request. If analytics is down, checkout fails.

                      Precise prompt

                      Publish order.placed {orderId, userId, total} to a topic. Subscribe email, inventory and analytics, each with its own queue and retries, each ignoring orderIds it has seen. Checkout only waits for the publish.

                      Typical resultCheckout returns as soon as the event is published, and a slow or broken analytics service falls behind on its own without blocking orders or emails.

                      Seen on

                      • Google Cloud Pub/Sub: Publishers send events to a topic without regard to how they will be processed, and Pub/Sub delivers them to all the services that subscribe.
                      • Redis: PUBLISH pushes a message to every client subscribed to a channel; delivery is at-most-once, so a subscriber that is disconnected misses it.

                      You might describe it as

                      • tell every service when something happens
                      • announce an event and whoever cares listens
                      • add a new listener without touching the sender

                      Not to be confused with

                      • Queue

                        Pub/sub gives every subscriber a copy of each event; a queue gives each message to only one worker.

                      • Fan-out

                        Pub/sub is the setup of topics and subscribers; fan-out is the copying of one message to many receivers, which a topic does for you.

                      Queue

                      Also called: message queue, job queue, work queue, task queue.

                      The web server answers each upload at once with 202 Accepted. A worker resizes one photo every 2 seconds and deletes the job only when it's done. If the worker crashes first, the job comes back after the visibility timeout (5 seconds here).

                      Waiting: 0 · In flight: 0 · Done: 0

                      No jobs yet. Worker 1 is waiting for work.

                        Waiting 0 flight 0 done 0 workers 1

                        A list of jobs that producers add to and workers take from, so slow work happens in the background instead of inside the request. Each message goes to one worker, and a message that isn't confirmed in time goes back on the queue for another try.

                        Say it in a prompt

                        Move image resizing out of the upload request into an SQS queue. The API saves the file, enqueues {imageId} and returns 202 right away. Run 4 workers with a 60-second visibility timeout, and delete a message only after the resize succeeds. After 5 failed receives, move it to a dead-letter queue.

                        Vague vs precise prompt

                        Vague prompt

                        uploading a photo takes forever, make it faster

                        Typical resultSwaps in a faster image library but still resizes inside the request, so a big upload still times out after 30 seconds.

                        Precise prompt

                        Put image resizing on an SQS queue: the API stores the file, enqueues {imageId} and returns 202. Run 4 workers with a 60s visibility timeout; delete the message only after success; move it to a DLQ after 5 receives.

                        Typical resultThe upload answers in well under a second, 4 workers resize in the background, and a crashed worker's job reappears for another worker after 60 seconds.

                        Seen on

                        • Amazon SQS: A received message stays hidden from other consumers for the visibility timeout (30 seconds by default); if it isn't deleted in time, it becomes visible again for another try.
                        • RabbitMQ: Its work queues tutorial hands each task to the next worker in turn, and redelivers a task to another worker if the first one dies before acknowledging it.

                        You might describe it as

                        • do the slow part in the background
                        • a to-do list that the workers pick jobs from
                        • don't make the user wait for the email to send

                        Not to be confused with

                        • Pub/sub

                          In a queue each message goes to one worker; in pub/sub every subscriber gets its own copy.

                        • Dead-letter queue

                          The queue holds work waiting to be done; the dead-letter queue holds the messages that kept failing.

                        • Transactional outbox

                          A queue holds work until a consumer takes it; a transactional outbox is a table in the sender's own database that makes sure the message gets to the queue at all.

                        Reliability 0 / 3

                        Staying up when parts fail.

                        Circuit breaker

                        Also called: breaker, fail fast.

                        The payments API is down. After 3 failed calls in a row the breaker opens: calls fail fast for 5 seconds, then one test call goes through.

                        Closed Calls go through. 0 of 3 failures.

                          Closed 0 api down

                          A wrapper around calls to another service that counts failures and, past a threshold, stops calling it for a while and fails fast instead (open). After a wait it lets a few test calls through (half-open), and if they succeed, normal calls resume (closed).

                          Say it in a prompt

                          Wrap calls to the payments API in a circuit breaker: 2-second timeout; open when 50% of the last 20 calls fail or time out; while open, fail fast for 30 seconds with a 'try again soon' error; then go half-open and allow 3 test calls, closing if all succeed and opening again if any fails.

                          Seen on

                          • Netflix Hystrix: Opens the circuit when request volume and error percentage pass their thresholds, short-circuits calls for a sleep window, then lets a single test request through (half-open).
                          • Resilience4j: Its CircuitBreaker has CLOSED, OPEN and HALF_OPEN states; by default it opens at a 50% failure rate, waits 60 seconds, then allows 10 calls in half-open.

                          You might describe it as

                          • stop calling the service that keeps timing out
                          • fail fast when the other API is down
                          • one broken service drags everything down with it

                          Not to be confused with

                          • Graceful degradation

                            A circuit breaker decides to stop calling a failing service; graceful degradation decides what the user sees instead.

                          • Rate limiting

                            A circuit breaker protects you from a dependency that is failing; rate limiting protects your service from callers sending too much.

                          • Health check

                            A circuit breaker is the caller deciding to stop calling a dependency that keeps failing; a health check is the platform testing each copy of a service and sending it no traffic while it fails.

                          Graceful degradation

                          Also called: degraded mode, fail soft, fallback.

                          The product is the core of the page; recommendations are an extra. Take Recommendations down and load the page again: the product still shows, with Popular items in place of personal picks.

                          Pages loaded: 0 · With a fallback: 0 · Error pages: 0

                          Not loaded yet. Both services are up.

                            Idle recs up

                            Designing a service so that when a dependency fails, its core job keeps working and only the extras are dropped or simplified. The page still loads with stale, default or missing parts instead of showing an error.

                            Say it in a prompt

                            Make the product page degrade gracefully: give the recommendations, reviews and stock services a 300 ms timeout each. If recommendations fail, show the cached bestseller list; if reviews fail, hide the reviews block; if stock fails, show 'Check availability at checkout'. Only a missing product returns an error page.

                            Vague vs precise prompt

                            Vague prompt

                            the product page shows an error when the reviews service is down, fix it

                            Typical resultAdds a retry loop around the reviews call. The page now takes 10 seconds and then shows the same error.

                            Precise prompt

                            Degrade gracefully: give recommendations, reviews and stock a 300ms timeout each. On failure show cached bestsellers, hide reviews, and show 'Check availability at checkout'. Only a missing product returns an error page.

                            Typical resultWhen reviews or recommendations are down, the page still loads quickly with those parts hidden or cached, and people can keep buying.

                            Seen on

                            • AWS Well-Architected Framework: Best practice REL05-BP01 asks components to keep their core function when dependencies fail, for example a store's landing page still showing everything else when the recommendations system is down.
                            • A search page still shows its results, without the 'people also bought' box, when the recommendations service times out.

                            You might describe it as

                            • show the page even if one part of it is broken
                            • hide the reviews box instead of erroring when that service is down
                            • keep checkout working when the extras fail

                            Not to be confused with

                            • Circuit breaker

                              Graceful degradation is what the user gets while a part is down; a circuit breaker is one way to notice the failure and stop calling that part.

                            Rate limiting

                            Also called: throttling, token bucket, request quota, API rate limit.

                            The bucket holds 5 tokens and gets 1 back every second. Each request spends one; with none left, the answer is 429.

                            No requests yet.

                              Tokens 5

                              Capping how many requests each client may make in a period and refusing the rest, usually with HTTP 429 Too Many Requests. A token bucket allows short bursts: every request spends a token, and tokens refill at a steady rate up to a fixed capacity.

                              Say it in a prompt

                              Rate-limit the public API per API key with a token bucket in Redis: capacity 20 tokens, refilled at 10 tokens per second. When the bucket is empty, return 429 Too Many Requests with a Retry-After header in seconds, and send X-RateLimit-Remaining on every response.

                              Seen on

                              • Stripe: Allows 100 API requests per second per account in live mode and 25 in a sandbox, answers extra requests with 429 Too Many Requests, and suggests a client-side token bucket.
                              • Amazon API Gateway: Throttles with the token bucket algorithm: the rate is how fast tokens are added and the burst is the bucket's capacity; throttled clients get 429.
                              • GitHub REST API: Authenticated users get 5,000 requests per hour; the x-ratelimit-remaining and x-ratelimit-reset headers show what is left and when it resets.

                              You might describe it as

                              • stop one client from flooding the API
                              • only let each key call it 10 times a second
                              • a bot is hammering our endpoint

                              Not to be confused with

                              • Backpressure

                                Rate limiting is a fixed allowance per client, and requests over it are refused; backpressure slows the sender down based on how busy the receiver is right now.

                              • Circuit breaker

                                Rate limiting protects your service from callers sending too much; a circuit breaker protects you from a dependency that is failing.

                              • API gateway

                                Rate limiting is one job, capping how many requests each client may make; an API gateway is a front door where that job often runs, next to checking keys and routing by path.

                              Performance 0 / 10

                              Making things fast and light on memory.

                              Bulk write

                              Also called: bulk insert, batch insert, multi-row insert.

                              Save 500 contacts: one INSERT per row, or one INSERT with all 500 rows. Compare the round trips and commits.

                              One by one
                              Round trips–
                              Commits–
                              Time–
                              One batch
                              Round trips–
                              Commits–
                              Time–

                              Nothing saved yet. 500 contacts are waiting to be imported.

                                Idle

                                Saving many rows with one database statement or one transaction, instead of one INSERT and one commit per row. Each round trip and each commit has a fixed cost, so 500 single inserts spend most of their time waiting. One multi-row INSERT, or COPY, pays that cost once.

                                Say it in a prompt

                                The contacts import saves 500 rows with one INSERT each. Validate every row first and report the bad ones by line number. Then insert the valid rows in batches of 500: one multi-row INSERT INTO contacts (name, email) VALUES (...), (...) per batch inside one transaction, or COPY for files over 10,000 rows. If a batch still fails, retry it in smaller batches to find the row that breaks it.

                                Vague vs precise prompt

                                Vague prompt

                                the CSV import is slow, make it faster

                                Typical resultRuns the import in a background job with a progress bar. It still sends one INSERT per row, so 500 rows still take 500 round trips and 500 commits.

                                Precise prompt

                                Validate the CSV rows first and report invalid ones by line number. Insert the valid rows in batches of 500 with one multi-row INSERT per batch inside one transaction (COPY for files over 10,000 rows). If a batch fails anyway, retry it in smaller batches to find the bad row.

                                Typical result500 rows go in 1 round trip and 1 commit, about 40 ms instead of 2.5 s. Bad rows are reported by line number before anything is saved.

                                Seen on

                                • PostgreSQL documentation: Populating a Database: committing each insert separately makes PostgreSQL do a lot of work per row, so turn off autocommit and commit once, or use COPY to load all rows in one command.
                                • MySQL Reference Manual: Optimizing INSERT Statements: an INSERT with many VALUES lists is considerably faster, many times in some cases, than separate single-row INSERTs.

                                You might describe it as

                                • load all the rows with one INSERT or COPY
                                • the import takes forever because it saves one row at a time
                                • one big insert instead of hundreds of small ones

                                Not to be confused with

                                • Batch endpoint

                                  A batch endpoint joins many HTTP calls into one; a bulk write joins many database writes into one statement.

                                • N+1 query

                                  N+1 is many small reads; a bulk write fixes many small writes.

                                Cache stampede

                                Also called: thundering herd, dogpile effect, request coalescing (the fix).

                                product:42 is a hot key in Redis. Expire it while 8 requests arrive, then turn on Coalesce misses and try again.

                                Requests: 0 · Cache misses: 0 · Database reads: 0

                                product:42 is in Redis, so requests for it never reach Postgres.

                                  Idle

                                  A popular cache key expires, and every request that arrives before it is filled again misses at the same moment. They all go to the database for the same row, so the database gets a sudden pile of identical reads. The fix lets one request reload the key while the others wait for its answer.

                                  Say it in a prompt

                                  Protect the product:{id} cache in Redis from a stampede: on a miss, only one request per key reloads it from Postgres (single flight inside each server, plus a Redis lock SET lock:product:{id} NX PX 5000 across servers); the others wait up to 2 s for the new value, then read the cache again. Add ±10% jitter to the 300-second TTL.

                                  Vague vs precise prompt

                                  Vague prompt

                                  the database spikes every few minutes, fix it

                                  Typical resultAdds more database CPU or a bigger instance. The spikes get smaller but still come every 5 minutes, when the hot keys expire.

                                  Precise prompt

                                  Stop cache stampedes on product:{id}: on a miss let one request per key reload it (single flight in each server and a Redis lock across servers), make the others wait for that value, and add ±10% jitter to the 300 s TTL.

                                  Typical resultWhen a hot key expires, Postgres gets one read for it instead of hundreds, and keys no longer expire all at the same second.

                                  Seen on

                                  • Wikipedia: Describes a cache stampede: when a busy cached item expires, many requests try to rebuild it at once; one fix is a lock so only one of them recomputes it.
                                  • Go packages (singleflight): singleflight suppresses duplicate calls: only one call per key runs at a time, and a duplicate caller waits for it and gets the same result.

                                  You might describe it as

                                  • everyone misses the cache at the same moment
                                  • the database spikes every time a hot key expires
                                  • let one request refill the cache while the rest wait

                                  Not to be confused with

                                  • TTL (time to live)

                                    A TTL makes a key expire; a cache stampede is what happens when a busy key expires and every request reloads it at once.

                                  • Cache-aside

                                    Cache-aside is the normal routine of reading the cache, then the database on a miss; a cache stampede is that routine going wrong when many requests miss the same key together.

                                  Connection pool

                                  Also called: pool, database pool, pool size.

                                  The app keeps a pool of 4 Postgres connections. Send 8 requests, then leak a few connections and send again.

                                  Served: 0 · Waited: 0 · Failed: 0 · Free: 4 of 4

                                  The pool has 4 open connections, all free.

                                    Fresh pool

                                    The app opens a few database connections once and keeps them in a pool. Each request borrows one, runs its queries and gives it back, so many requests share a few connections; when all are in use, new requests wait in line. A request that never gives its connection back leaks it, and when every connection has leaked, new requests time out.

                                    Say it in a prompt

                                    Use a node-postgres Pool with max 10 connections per server and connectionTimeoutMillis 5000. In every handler, get a client with pool.connect(), run the queries in try, and call client.release() in finally so a connection is returned even on errors. Log the pool's totalCount, idleCount and waitingCount every 30 seconds.

                                    Vague vs precise prompt

                                    Vague prompt

                                    the app gets slow and then stops answering under load, fix the database

                                    Typical resultOpens a new database connection for every request. Under load Postgres hits max_connections and starts refusing them, and the bug that never returns connections is still there.

                                    Precise prompt

                                    Use a pg Pool with max 10 per server and a 5 s connectionTimeoutMillis. Borrow with pool.connect(), always client.release() in finally, and log totalCount, idleCount and waitingCount every 30 s.

                                    Typical resultEach server keeps at most 10 connections open. Extra requests wait a moment instead of overloading Postgres, connections are never leaked, and the logs show when the pool is too small.

                                    Seen on

                                    • node-postgres: Its pooling guide says you must always release a client back to the pool, even after an error; otherwise the pool leaks clients until it is empty and new requests wait forever.
                                    • HikariCP wiki: About Pool Sizing argues for a small pool, with the app's threads waiting in line for a connection, instead of hundreds of connections fighting over the database.

                                    You might describe it as

                                    • reuse a few database connections for many requests
                                    • requests wait in line for a free database connection
                                    • the app hangs with timed out waiting for a connection

                                    Not to be confused with

                                    • Backpressure

                                      A connection pool caps how many requests use the database at the same time; backpressure is the slow side telling the fast side to slow down.

                                    Database index

                                    Also called: index, B-tree index, secondary index.

                                    Find one user by email in a 12-row table, first without an index, then with one.

                                    Table rows read
                                    –
                                    Index steps
                                    –

                                    No index on email yet. Postgres can only read the table row by row.

                                      No index

                                      A sorted copy of one or more columns, each entry pointing to its row, that the database keeps next to a table. A query that filters on that column can jump to the matching rows instead of reading the whole table. Each insert and update also has to update the index, so add indexes for the queries you actually run.

                                      Say it in a prompt

                                      Add a Postgres index on users(email) with CREATE INDEX CONCURRENTLY users_email_idx, so the login query stops scanning the whole table. Show EXPLAIN ANALYZE for SELECT * FROM users WHERE email = $1 before and after (Seq Scan vs Index Scan, rows read, time), and add a unique constraint if emails must be unique.

                                      Vague vs precise prompt

                                      Vague prompt

                                      login is slow, speed up the database

                                      Typical resultSuggests a bigger database server or a cache in front of the users table. Every login still reads every row, so it slows down again as users sign up.

                                      Precise prompt

                                      Login runs SELECT * FROM users WHERE email = $1 and EXPLAIN shows a Seq Scan. Add CREATE INDEX CONCURRENTLY users_email_idx ON users (email) and show EXPLAIN ANALYZE before and after.

                                      Typical resultThe plan changes from Seq Scan to Index Scan: 1 row read instead of the whole table, and login stays fast at 1,000,000 users.

                                      Seen on

                                      • PostgreSQL documentation: Without an index the database has to scan the whole table row by row; with one it can walk a few levels down a search tree. Shows CREATE INDEX test1_id_index ON test1 (id).
                                      • Use The Index, Luke: A free book on SQL indexing. Explains the B-tree and that real indexes with millions of rows are only four or five levels deep.

                                      You might describe it as

                                      • make the database find the row without reading everything
                                      • the query gets slower as the table grows
                                      • look up users by email fast

                                      Not to be confused with

                                      • Read replica

                                        An index helps one database find rows faster; a replica adds copies so more reads can run at once.

                                      Distributed trace

                                      Also called: tracing, trace, OpenTelemetry trace.

                                      Send one checkout request. Each service it passes adds a span to the same trace, and the waterfall shows where the time went.

                                      Nothing traced yet. The request will pass 4 services.

                                        Idle

                                        A record of one request as it moves through several services. Each step is a span with a start time and a duration, and every span carries the same trace id. Shown as a waterfall, it tells you where the request spent its time.

                                        Say it in a prompt

                                        Add OpenTelemetry tracing to the gateway, the Orders API and the email service. Pass the trace id between services in the W3C traceparent header, add a span for every database query and outgoing HTTP call, send spans to Jaeger, and put the trace id in every log line so a slow checkout can be found from its logs.

                                        Vague vs precise prompt

                                        Vague prompt

                                        checkout is slow sometimes, find out why

                                        Typical resultAdds console.log timings in one service. The logs of the gateway, the API and the email service can't be matched up, so nobody sees that checkout waits for the email.

                                        Precise prompt

                                        Add OpenTelemetry tracing to the gateway, Orders API and email service, pass the trace id in the traceparent header, add spans for database queries and HTTP calls, export to Jaeger, and log the trace id with every line.

                                        Typical resultOne slow checkout opens as a waterfall of 4 spans: the email call takes 340 of the 420 ms, so the fix is to send the email in the background.

                                        Seen on

                                        • OpenTelemetry: Explains that a trace is made of spans, each with a start and end time, a parent span, and the trace id they all share.
                                        • W3C Trace Context: The standard traceparent HTTP header that carries the trace id from one service to the next, for example 00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01.

                                        You might describe it as

                                        • follow one request through all the services
                                        • see which service made the page slow
                                        • a timeline of every call one click made

                                        Not to be confused with

                                        • p99 latency

                                          p99 tells you that some requests are slow; a trace shows where one request spent its time.

                                        • Flame graph

                                          A trace follows one request across services over time; a flame graph adds up where CPU time goes inside one program.

                                        Flame graph

                                        Also called: CPU profile, profiler, flame chart.

                                        Take a profile: the wider a bar, the more CPU time that function used. Then cache the fonts and profile again.

                                        Profile
                                        0 s of 10
                                        Samples
                                        0
                                        CPU per request
                                        –

                                        No profile yet. The PDF service is busy and nobody knows why.

                                          Idle

                                          A picture of a CPU profile: a profiler samples the call stack many times a second, and each function becomes a bar as wide as its share of the samples. Callers sit below the functions they call. The widest bars at the top are where the CPU time really goes.

                                          Say it in a prompt

                                          Profile the PDF service under load with async-profiler for 30 seconds and save a CPU flame graph. List the 3 widest frames with their share of samples, fix the top one, then profile again under the same load and show both graphs side by side with the CPU time per request before and after.

                                          Vague vs precise prompt

                                          Vague prompt

                                          the PDF export uses too much CPU, optimize it

                                          Typical resultGuesses at the cause: rewrites the template loop and adds a cache for the database query. The CPU use barely moves, because the real cost was loading fonts on every request.

                                          Precise prompt

                                          Take a 30-second CPU profile of the PDF service under load (async-profiler, flame graph output). Name the 3 widest frames with their share of samples, fix the widest one, and profile again under the same load to show the CPU per request before and after.

                                          Typical resultThe flame graph shows loadFonts at 55% of the samples. Caching the fonts cuts CPU per request from about 400 ms to about 185 ms, and the second graph proves it.

                                          Seen on

                                          • Brendan Gregg: The page by the inventor of flame graphs: the wider a frame, the more often it was in the sampled stacks, and the x-axis is sorted by name, not time.
                                          • Grafana Pyroscope: Its docs explain reading a flame graph: each bar is a function, its width is the time spent in it, and the bars stack in call order.

                                          You might describe it as

                                          • find which function eats the CPU
                                          • a chart of where the server spends its time
                                          • wide bars show the expensive code

                                          Not to be confused with

                                          • Distributed trace

                                            A trace follows one request across services over time; a flame graph adds up where CPU time goes inside one program.

                                          Memoization

                                          Also called: memoize, memo, function cache.

                                          A report with 6 rows calls priceRules(version) once per row. The rows share only 2 versions. Run it, then turn on Memoize and run it again.

                                          Computations: 0 · Memo lookups: 0 · Time: about 0 ms

                                          Nothing run yet. Memoize is off.

                                            Idle

                                            A function remembers its answer for each input it has seen. The first call with an input does the slow work and stores the answer in a small map; the next call with the same input returns the stored answer at once. It only works for functions that always give the same answer for the same input.

                                            Say it in a prompt

                                            Memoize priceRules(formVersion) inside the report job: keep a Map from version to result for one report run, compute on the first call for a version and return the stored result after that. The report has 6,000 rows but only 12 versions, so expect 12 computations, not 6,000. Clear the map when the run ends.

                                            Vague vs precise prompt

                                            Vague prompt

                                            the report is slow, make it faster

                                            Typical resultAdds Redis in front of the whole report with a 1-hour TTL. The first run is still slow, and people see an old report for an hour.

                                            Precise prompt

                                            Memoize priceRules(formVersion) for one report run with a Map keyed by version: compute once per version, reuse the result for every other row, and clear the map when the run ends.

                                            Typical result6,000 rows with 12 versions do 12 slow computations instead of 6,000. Nothing extra to run or expire, and the next run starts fresh.

                                            Seen on

                                            • Python docs: functools.cache and lru_cache wrap a function so calls with the same arguments return the saved result; the docs call it memoizing and say it saves time for expensive functions.
                                            • React docs: useMemo caches the result of a calculation between re-renders and only runs it again when one of its inputs changes.

                                            You might describe it as

                                            • a function that remembers its answers
                                            • don't compute the same thing twice in one run
                                            • same input, so reuse the result from last time

                                            Not to be confused with

                                            • Cache-aside

                                              Memoization remembers a function's answers inside one running program, keyed by its inputs; cache-aside keeps shared data in a cache like Redis, with a TTL, for every server.

                                            OOM kill

                                            Also called: out of memory, OOMKilled, exit code 137.

                                            A Java app in a pod with a 4 GiB memory limit. Its memory is the heap (-Xmx) plus 0.6 GiB outside the heap. Try -Xmx3g, then -Xmx3800m.

                                            Heap: 0 GiB · Non-heap: 0 GiB · Total: 0 of 4 GiB · Restarts: 0

                                            Nothing running yet. The container may use 4 GiB in all: heap and non-heap together.

                                              Idle

                                              A container has a memory limit. When the program inside uses more than that, the Linux kernel kills it, and Kubernetes shows OOMKilled with exit code 137 and restarts it. For a Java app the memory is the heap (-Xmx) plus everything outside the heap, so a heap set too close to the limit gets the container killed.

                                              Say it in a prompt

                                              Our Java service in Kubernetes keeps restarting with OOMKilled (exit code 137). The container limit is 4Gi and the JVM runs with -Xmx3800m. Replace -Xmx3800m with -XX:MaxRAMPercentage=75 (an explicit -Xmx wins over it), so the heap is about 3 GiB and threads, metaspace and buffers fit in the rest. Set requests.memory equal to the limit, and alert when container memory goes over 90% of the limit.

                                              Vague vs precise prompt

                                              Vague prompt

                                              the service keeps crashing, give it more memory

                                              Typical resultRaises -Xmx to match the new limit, so the heap plus threads and metaspace still go past it, and the pod is killed again a little later.

                                              Precise prompt

                                              The pod is OOMKilled (exit 137) at a 4Gi limit with -Xmx3800m. Replace -Xmx3800m with -XX:MaxRAMPercentage=75 (an explicit -Xmx wins over it) so the heap is about 3 GiB and the rest of the JVM fits, and alert above 90% of the limit.

                                              Typical resultThe heap stops at about 3 GiB and garbage collection works inside it; threads, metaspace and buffers fit in the last GiB, so the kernel no longer kills the container.

                                              Seen on

                                              • Kubernetes docs: Assign Memory Resources: a container that goes over its memory limit is terminated with reason OOMKilled and exit code 137, and the kubelet restarts it.
                                              • Kubernetes docs: Resource Management: memory limits are enforced by the kernel with out-of-memory (OOM) kills when a container uses more than its limit.
                                              • Java docs (the java command): -Xmx sets the maximum size of the heap. In its -XX:AllocateHeapAt entry, the page names the code heap, metaspace and thread stacks as separate memory structures.

                                              You might describe it as

                                              • the pod keeps restarting with exit code 137
                                              • the container dies with no error in the app's logs
                                              • memory goes over the container limit and it gets killed

                                              Not to be confused with

                                              • Streaming results

                                                An OOM kill is what happens when a program's memory goes past its container's limit; streaming results is one way to avoid it, by reading big data in small pieces.

                                              p99 latency

                                              Also called: tail latency, 99th percentile, percentile latency.

                                              Each bar is one request: the taller, the slower. Send 100 requests and compare the average with p99.

                                              Requests
                                              0
                                              Average
                                              –
                                              p50
                                              –
                                              p99
                                              –

                                              Nothing sent yet. Most requests take about 40 ms; a few call a slow tax service.

                                                Idle

                                                The response time that 99% of requests beat: sort the times, and the one 1% from the slow end is p99. An average hides a few very slow requests, but p99 shows them. p50 (the median) is what a typical user sees.

                                                Say it in a prompt

                                                Add p50, p95 and p99 latency for every endpoint, measured with an OpenTelemetry histogram and shown per endpoint on the dashboard, not as an average. Alert when p99 of GET /orders is above 300 ms for 5 minutes, and log the trace id of any request slower than 1 s so we can see where it waited.

                                                Vague vs precise prompt

                                                Vague prompt

                                                check if the API is fast enough

                                                Typical resultAdds an average response time to the dashboard. It says 55 ms, so everything looks fine, while 2 users in 100 wait about 0.8 s.

                                                Precise prompt

                                                Record a latency histogram per endpoint and show p50, p95 and p99 on the dashboard instead of the average. Alert when p99 of GET /orders is over 300 ms for 5 minutes, and log the trace id of requests slower than 1 s.

                                                Typical resultThe dashboard shows the slow 1% (p99 790 ms) next to the typical 40 ms, an alert fires when the tail gets worse, and the slow requests come with a trace id to look into.

                                                Seen on

                                                • Google SRE book: Says an average hides a long tail of much slower requests, and suggests a high percentile like the 99th as a plausible worst case.
                                                • Amazon CloudWatch: Explains percentiles (the 95th percentile is the value 95% of data points are below) and that watching the average can hide unusual values. Load balancer, API Gateway and Lambda metrics support them.

                                                You might describe it as

                                                • the average looks fine but some users wait for ages
                                                • how slow the slowest requests are
                                                • fast for most people, slow for a few

                                                Not to be confused with

                                                • Request timeout

                                                  A timeout cuts one slow request off; p99 measures how slow the slowest 1% of requests are.

                                                • Distributed trace

                                                  p99 tells you that some requests are slow; a trace shows where one request spent its time.

                                                Streaming results

                                                Also called: streaming, chunked processing.

                                                Export 3,000,000 orders to a CSV file. The export job has a 2 GiB memory limit. Stream in chunks, then try loading everything first.

                                                Rows read: 0 · Rows in the file: 0 · Peak memory: 200 MiB

                                                Nothing exported yet. The job uses 200 MiB before it reads any rows.

                                                  Idle

                                                  The code reads a big result in small pieces, for example 1,000 rows at a time, and finishes each piece before it reads the next. Only one piece is in memory at once, so memory stays small and flat however big the data is.

                                                  Say it in a prompt

                                                  Rewrite the orders CSV export to stream: read Postgres with a cursor (pg-cursor) 1,000 rows at a time, turn each chunk into CSV lines and write them to the file with stream.pipeline, then read the next chunk. Never load the whole table into an array. Memory must stay under 300 MiB for 3 million rows.

                                                  Vague vs precise prompt

                                                  Vague prompt

                                                  the export crashes on big customers, fix it

                                                  Typical resultRaises the container memory from 2 GiB to 8 GiB. It still runs SELECT * into one array, so the next, bigger customer crashes it again (in Node it may even die first with "JavaScript heap out of memory", when V8's own heap limit is lower than the container's).

                                                  Precise prompt

                                                  Stream the export: read orders with a Postgres cursor 1,000 rows at a time, write each chunk to the CSV file with stream.pipeline before reading the next. Keep memory under 300 MiB for any size.

                                                  Typical resultMemory stays near 200 MiB for 3 million rows or 30 million. The export takes longer for bigger data, but it does not crash.

                                                  Seen on

                                                  • node-postgres: Its Cursor reads a large result set a few rows at a time, without loading the whole result into memory first.
                                                  • PostgreSQL docs: FETCH reads the next rows from a cursor, for example FETCH FORWARD 1000, so a client can take a big query in pieces.
                                                  • Node.js docs: Streams handle data chunk by chunk, and stream.pipeline connects a reader to a writer and manages the flow between them.

                                                  You might describe it as

                                                  • export a huge table without loading all of it
                                                  • read a little, write a little, repeat
                                                  • memory stays flat no matter how big the file is

                                                  Not to be confused with

                                                  • Server-sent events (SSE)

                                                    Server-sent events stream messages to a browser over one open HTTP connection; streaming results means your code handles data in pieces so memory stays small.

                                                  • OOM kill

                                                    Streaming results keeps memory small by reading big data in pieces; an OOM kill is what happens when memory goes past the container's limit.

                                                  • Backpressure

                                                    Streaming results handles big data in small pieces so memory stays small; backpressure is the slow consumer making the fast producer wait, so the pieces don't pile up between them.

                                                  Deploy and run 0 / 8

                                                  How code is packaged, started and scaled.

                                                  Autoscaling

                                                  Also called: auto scaling, HPA, horizontal pod autoscaler, KEDA.

                                                  Consumer pods read orders from Kafka. The rule: while the lag (messages waiting) is over 800, add a pod. Start a traffic spike, then wait for the cool-down.

                                                  Pods: 1 of 6 · Lag: 0 · Time: 0:00

                                                  Normal traffic: 1 pod keeps up and the lag is 0.

                                                    1 pod

                                                    A rule that adds and removes copies of your app for you, based on a number you watch, such as CPU or the lag of a queue. It checks the number again and again, adds copies while it is too high, and removes them after it has stayed low for a while. A minimum and a maximum keep the count in a safe range.

                                                    Say it in a prompt

                                                    Autoscale the order-consumer Deployment on Kafka consumer lag with a HorizontalPodAutoscaler (or KEDA): min 1, max 6 pods, because the orders topic has 6 partitions. Add at most 1 pod every 15 seconds while lag is over 800 messages. Scale down only after lag has stayed low for 5 minutes (stabilizationWindowSeconds: 300), 1 pod every 15 seconds.

                                                    Vague vs precise prompt

                                                    Vague prompt

                                                    make the consumers scale automatically

                                                    Typical resultAdds an autoscaler on CPU with a maximum of 20 pods. The consumers mostly wait on Kafka, not the CPU, so the lag grows and nothing scales; and when it does scale, a 6-partition topic leaves up to 14 of the 20 pods idle.

                                                    Precise prompt

                                                    Autoscale the order consumers on Kafka lag: min 1, max 6 (6 partitions). Add 1 pod every 15 s while lag > 800; scale down only after 5 minutes of low lag.

                                                    Typical resultA spike adds pods one by one until the lag falls, never more pods than partitions, and the extra pods go away 5 minutes after it is calm, so a short dip doesn't make them flap.

                                                    Seen on

                                                    • Kubernetes docs: The HorizontalPodAutoscaler checks a metric every 15 seconds by default and changes the number of replicas; scale-down waits for a 300-second stabilization window, and policies can limit how many pods are added or removed per period.
                                                    • KEDA docs: Its Apache Kafka scaler scales a consumer on consumer-group lag (lagThreshold), and by default never runs more replicas than the topic has partitions.

                                                    You might describe it as

                                                    • add servers automatically when the queue backs up
                                                    • scale with the traffic, then shrink back when it is quiet
                                                    • let a rule decide how many copies to run

                                                    Not to be confused with

                                                    • Horizontal scaling

                                                      Horizontal scaling is adding copies; autoscaling is a rule that adds and removes them for you.

                                                    Canary deploy

                                                    Also called: canary release, canary.

                                                    Each step sends a share of traffic to v2 and watches its error rate for 10 minutes (shortened here). Over 1% errors means an automatic rollback.

                                                    Meters: errors measured over each 10-minute step (tick: the 1% limit). The dots are a small sample of the requests.

                                                    Traffic: v1 100% · v2 0% · Drawn requests: v1 0, v2 0, failed 0

                                                    v1 serves everyone. Release v2 to try it on 10% of the traffic first.

                                                      v1 only

                                                      Releasing a new version to a small share of real traffic first, for example 10%, while the old version serves the rest. If its error rate and latency look as good as the old version's, the share grows step by step to 100%; if not, all traffic goes back to the old version. A bad release then hurts only the few users who were sent to it.

                                                      Say it in a prompt

                                                      Release the checkout service with Argo Rollouts as a canary: setWeight 10, pause 10 minutes, setWeight 50, pause 10 minutes, then 100. Run a background analysis on Prometheus the whole time: abort and roll back if the canary's 5xx rate is over 1% or its p99 latency is over 800 ms.

                                                      Vague vs precise prompt

                                                      Vague prompt

                                                      deploy the new checkout version safely

                                                      Typical resultSwaps every pod to the new version at once with a rolling update. Health checks pass, so a bug in the payment step reaches 100% of users until someone notices and redeploys by hand.

                                                      Precise prompt

                                                      Canary with Argo Rollouts: 10% for 10 min, 50% for 10 min, then 100%; abort and roll back if the canary's 5xx rate is over 1% or p99 over 800 ms.

                                                      Typical resultA bad build reaches only 10% of checkouts for at most 10 minutes before it rolls back by itself, and a good build reaches everyone in about 20 minutes.

                                                      Seen on

                                                      • Google SRE Workbook: Defines canarying as a partial and time-limited deployment of a change, evaluated against the rest of the service (the control), which keeps running the old version.
                                                      • Argo Rollouts docs: A canary rollout is a list of steps such as setWeight (the share of traffic for the new version) and pause; a background analysis that fails aborts the rollout.

                                                      You might describe it as

                                                      • try the new version on a few users first
                                                      • roll out slowly and roll back if errors go up
                                                      • send 10% of traffic to the new release

                                                      Not to be confused with

                                                      • Health check

                                                        A canary deploy asks "is the new version as good as the old one for real users?"; a health check asks "is this pod alive and ready?".

                                                      • Feature flag

                                                        A canary deploy sends a share of traffic to a new version of the whole app; a feature flag turns one feature on or off inside the same running version, with no deploy.

                                                      Cold start

                                                      Also called: cold start latency, warm start, provisioned concurrency (the fix).

                                                      A Java function with heavy start-up code, so a cold start costs 1.8 s (a small Node.js or Python function starts in a few hundred ms). The bar shows one request's time, 1.9 s across. How long a platform keeps an idle instance is not promised; this demo uses 15 minutes.

                                                      Last request: none yet

                                                      Requests: 0 · Cold starts: 0 · Last: none

                                                      No instance is running yet. The first request will have to wait for one to start.

                                                        No instance

                                                        The extra wait when a serverless platform has no ready copy of your function and must start a new one first: set up the environment, load the language runtime and run your start-up code. That takes a few hundred ms for a small Node.js or Python function, and can pass 1 s for a Java function with heavy start-up code. A warm copy skips all of it, until the platform removes it after some idle time and the next request is cold again.

                                                        Say it in a prompt

                                                        Cut cold starts on the /report Lambda (Java): move SDK clients and config loading out of the handler, drop unused libraries to shrink the package, and set provisioned concurrency to 2 on the live alias during working hours (8:00 to 20:00). Log Init Duration so we can see how often cold starts happen.

                                                        Vague vs precise prompt

                                                        Vague prompt

                                                        the Lambda is slow sometimes, fix it

                                                        Typical resultDoubles the memory and adds a scheduled ping every 5 minutes. The ping keeps only one copy warm, so a burst of users still waits for new copies, and the cost goes up.

                                                        Precise prompt

                                                        Cut cold starts on /report: SDK clients and config out of the handler, drop unused libraries, provisioned concurrency 2 on the live alias 8:00 to 20:00, log Init Duration.

                                                        Typical resultStart-up work runs once per copy, two copies are always ready in working hours, and the Init Duration log shows how many requests still get a cold start.

                                                        Seen on

                                                        • AWS Lambda docs: Explains cold starts: Lambda downloads your code, starts the environment and runs init code before the handler; a reused environment is a warm start. Cold starts take from under 100 ms to over 1 second.
                                                        • AWS Lambda docs: Provisioned concurrency keeps a set number of environments initialized in advance, so requests to them have no cold start; it costs extra.

                                                        You might describe it as

                                                        • the first request after a quiet time is slow
                                                        • the Lambda takes seconds to wake up
                                                        • keep one copy warm so nobody waits

                                                        Not to be confused with

                                                        • Serverless function

                                                          A cold start is the delay when the platform must start a new copy of your function; serverless is the model where the platform starts and stops those copies for you.

                                                        Container image

                                                        Also called: Docker image, image, Dockerfile.

                                                        Build the image once, push it to a registry, and every server runs a container from that same image.

                                                        Image: none · In the registry: no · Containers: 0

                                                        No image yet. The servers have nothing to run.

                                                          Idle

                                                          A package with everything your app needs to run: a base system with the language runtime, your app files and the command that starts it. You build it once from a Dockerfile, give it a tag like shop:1.4.2 and push it to a registry. Every server then pulls that same image and starts containers from it, so they all run exactly the same code.

                                                          Say it in a prompt

                                                          Write a Dockerfile for the shop service: start FROM eclipse-temurin:21-jre, copy only the built app.jar, run as a non-root user, and start it with CMD java -jar /app/app.jar. Build it in CI, tag it with the release version (shop:1.4.2), push it to our registry, and deploy by the image digest so every server runs the same build.

                                                          Vague vs precise prompt

                                                          Vague prompt

                                                          put the app in Docker

                                                          Typical resultWrites a Dockerfile FROM a full JDK image, copies the whole repo with the source code and build cache, runs as root and tags it latest. The image is huge, and nobody can tell which build a server is running.

                                                          Precise prompt

                                                          Dockerfile FROM eclipse-temurin:21-jre, copy only app.jar, non-root user, CMD java -jar /app/app.jar. CI builds it, tags it shop:1.4.2 and pushes it to the registry; deploys pull it by digest.

                                                          Typical resultA small image with only the runtime and the jar. Every server pulls the same tagged build, so a bug can be traced to one version and a rollback is just the previous tag.

                                                          Seen on

                                                          • Docker docs: Describes an image as a standard package with all the files, binaries, libraries and configuration to run a container; images can't be changed after they are built.
                                                          • Docker docs: Explains that an image is made of layers, each a set of file changes, and that layers are reused between images and builds.
                                                          • Kubernetes docs: You build an image and push it to a registry before a Pod uses it; giving the digest instead of a tag makes every Pod run the same version.

                                                          You might describe it as

                                                          • build it once, run the same thing on every server
                                                          • package the app with its runtime so it starts anywhere
                                                          • the thing CI builds and the servers pull

                                                          Not to be confused with

                                                          • Sidecar

                                                            A container image is the package a container starts from; a sidecar is a second, running container next to your app in the same pod.

                                                          Health check

                                                          Also called: liveness probe, readiness probe, /healthz.

                                                          Every 10 s the kubelet asks each pod GET /ready (can it take traffic?) and GET /healthz (is it alive?). Here 10 s is shortened to half a second.

                                                          In the load balancer: pods 1, 2, 3 · Failed requests: 0 · Restarts: 0

                                                          3 pods are ready and share the requests. Freeze pod 3 to see the probes find it.

                                                            3 pods ready

                                                            A small request the platform sends to each copy of your app every few seconds to ask "are you alive?" and "can you take traffic?". A copy that is not ready gets no traffic, and a copy that stops answering is restarted. In Kubernetes these checks are called probes.

                                                            Say it in a prompt

                                                            Add health checks to the orders service on Kubernetes: a readiness probe on GET /ready (200 only after the database pool and caches are warm) and a liveness probe on GET /healthz (200 if the process can answer), both every 10 seconds with a 1-second timeout and failureThreshold 3. /healthz must not call the database, so a database outage does not restart every pod.

                                                            Vague vs precise prompt

                                                            Vague prompt

                                                            make Kubernetes restart the app if it breaks

                                                            Typical resultAdds one liveness probe that calls the database. When the database is slow, every pod fails it at once and Kubernetes restarts all of them, and new pods get traffic before they have started.

                                                            Precise prompt

                                                            Add a readiness probe on GET /ready (200 only when warm) and a liveness probe on GET /healthz (no database calls), every 10 s, 1 s timeout, failureThreshold 3.

                                                            Typical resultNew pods get traffic only once they are ready, a hung pod is taken out and restarted after about 30 seconds, and a slow database does not restart the whole fleet.

                                                            Seen on

                                                            • Kubernetes docs: When a liveness probe fails more times than allowed, the kubelet restarts the container; when a readiness probe fails, the pod's IP is removed from its Services, so it gets no traffic. Probes run every 10 seconds by default.
                                                            • Kubernetes docs: A step-by-step task page: configure an HTTP liveness probe on /healthz, and a readiness probe so a pod that is still starting gets no traffic from Services.

                                                            You might describe it as

                                                            • restart the server when it hangs
                                                            • don't send traffic until the app has started
                                                            • an endpoint that says the service is up

                                                            Not to be confused with

                                                            • Circuit breaker

                                                              A health check is the platform testing each copy of your app and sending it no traffic while it fails; a circuit breaker is the caller that stops calling a dependency that keeps failing.

                                                            • Canary deploy

                                                              A health check asks "is this pod alive and ready?"; a canary deploy asks "is the new version as good as the old one for real users?".

                                                            • Load balancer

                                                              A health check decides which copies of your app may get traffic; a load balancer spreads the requests over the copies that pass.

                                                            • Smoke test

                                                              A health check asks each pod "are you alive and ready?" every few seconds, all the time; a smoke test walks a few main user paths once, right after a deploy.

                                                            Horizontal scaling

                                                            Also called: scale out, add replicas.

                                                            One server with 4 cores is at 100% CPU and requests are slow. Each button starts from there: make the one server bigger, or run 3 copies of it.

                                                            Servers: 1 · Cores each: 4 · CPU: 100% · Response: 2.1 s

                                                            One server with 4 cores is at 100% CPU. Requests wait in line: 2.1 s each.

                                                              1 server at 100%

                                                              Handling more load by running more copies of the app, with a load balancer spreading requests across them. The other way, vertical scaling, makes one machine bigger: it often needs a restart, and there is a biggest size. Copies only work if any copy can serve any request, so state like sessions lives outside the app.

                                                              Say it in a prompt

                                                              Scale the web app horizontally: run it as 3 replicas of the same container image behind the load balancer, each with 2 CPU cores and 4 GiB of memory. Keep the app stateless (sessions in Redis, uploads in object storage), so any replica can serve any request, and make sure a replica can be added or removed without a restart of the others.

                                                              Vague vs precise prompt

                                                              Vague prompt

                                                              the server is at 100% CPU, make it handle more

                                                              Typical resultMoves the app to a bigger machine with twice the cores. It goes down for the switch, it is still one machine that can crash, and next year it needs an even bigger one.

                                                              Precise prompt

                                                              Run the app as 3 replicas of the same image behind the load balancer, 2 cores each. Move sessions to Redis and uploads to object storage so any replica can serve any request.

                                                              Typical resultLoad spreads over 3 copies at about a third of the CPU each. Adding a 4th copy is one command, and one copy crashing leaves 2 that keep serving.

                                                              Seen on

                                                              • Kubernetes docs: Defines horizontal scaling as answering more load by running more Pods, and vertical scaling as giving the running Pods more CPU or memory.
                                                              • Kubernetes docs: kubectl scale sets a new number of replicas for a Deployment or ReplicaSet, for example --replicas=3.
                                                              • Azure Architecture Center: Design to scale out: add or remove instances to match demand, make sure any instance can handle any request (no session stickiness), and find bottlenecks such as the database first.

                                                              You might describe it as

                                                              • run more copies instead of a bigger server
                                                              • add servers when one is not enough
                                                              • spread the load over identical copies of the app

                                                              Not to be confused with

                                                              • Load balancer

                                                                Horizontal scaling adds more copies of the app; a load balancer spreads the requests across those copies.

                                                              • Autoscaling

                                                                Horizontal scaling is adding copies of the app, by hand or by a rule; autoscaling is the rule that adds and removes them for you as the load changes.

                                                              Serverless function

                                                              Also called: AWS Lambda, function as a service (FaaS), cloud function.

                                                              Each upload runs the function once. The platform starts instances when uploads come and shuts them down when they stop. You pay for the milliseconds of work, not for a server waiting.

                                                              Instances: 0 · PDFs converted: 0 · Billed: 0 ms

                                                              No uploads, so no instances run and nothing is billed.

                                                                Scaled to zero

                                                                A small piece of code you upload, and the cloud platform runs it each time an event comes in, such as a file upload or an HTTP request. The platform starts as many copies as there are events at the same time and removes them when work stops. You pay only for the time your code runs, not for idle servers.

                                                                Say it in a prompt

                                                                Convert uploaded PDFs with a small AWS Lambda function in Node.js: trigger it on s3:ObjectCreated for the uploads/ prefix, 1,024 MB memory, 60-second timeout, and write the result to the converted/ prefix. Cap it at 50 concurrent runs (reserved concurrency) so it can't overload the database, and send failed events to a dead-letter queue.

                                                                Vague vs precise prompt

                                                                Vague prompt

                                                                process the PDFs in the cloud so we don't need a server

                                                                Typical resultWrites one Lambda that lists the whole bucket every few minutes and converts files one by one in a loop, so a busy hour hits the 15-minute timeout and some files are done twice.

                                                                Precise prompt

                                                                One AWS Lambda run per upload, triggered by s3:ObjectCreated on uploads/, writing to converted/; 1,024 MB, 60 s timeout, at most 50 at once, failures to a dead-letter queue.

                                                                Typical resultEach PDF gets its own run as soon as it lands, 50 can run side by side, nothing runs (or costs) when there are no uploads, and a file that fails is kept for a retry.

                                                                Seen on

                                                                • AWS Lambda docs: For each request in flight at the same time, Lambda starts a separate execution environment; when one finishes, it can be reused for the next request instead of starting a new one.
                                                                • AWS Lambda pricing: Duration is billed from when your code starts until it returns, rounded up to the nearest 1 ms; set-up (init) code is billed too, and there is no duration charge while nothing runs.

                                                                You might describe it as

                                                                • run my code without managing a server
                                                                • pay only when the code runs
                                                                • a function that runs when a file is uploaded

                                                                Not to be confused with

                                                                • Cold start

                                                                  Serverless means the platform starts copies of your function when events come and removes them when work stops; a cold start is the delay when it has to start a new copy.

                                                                Sidecar

                                                                Also called: sidecar container, sidecar proxy.

                                                                The app and its helper share one pod. The app only talks to localhost; the sidecar ships the traces. Stop the backend and watch the app stay fast.

                                                                Answered: 0 · App time: 40 ms · Buffered: 0 · Shipped: 0 · Dropped: 0

                                                                No requests yet. The tracing backend is up.

                                                                  Idle

                                                                  A second container that runs in the same pod as your app and helps it, for example by shipping logs or traces, or by acting as a proxy. The two share the network, so the app just talks to localhost. The helper can be updated, limited or restarted on its own, without changing the app's code.

                                                                  Say it in a prompt

                                                                  Run an OpenTelemetry Collector as a sidecar container in the checkout pod. The app sends its spans over OTLP to localhost:4317; the collector batches them and exports them to the tracing backend. If the backend is down, the collector keeps data in a bounded sending_queue and retries with retry_on_failure; when the queue is full, new data is dropped instead of slowing the app. The backend address and API key live only in the collector config. Give the sidecar its own CPU and memory limits.

                                                                  Vague vs precise prompt

                                                                  Vague prompt

                                                                  send our traces to the tracing tool

                                                                  Typical resultAdds the vendor's exporter to every service, with the backend address and API key in each app's config. Retries and buffering differ per language, spans kept in the app's memory are lost when it restarts, and changing the tracing backend means a new release of every service.

                                                                  Precise prompt

                                                                  Add an OpenTelemetry Collector sidecar to the checkout pod. The app exports spans to localhost:4317; the collector batches them, retries with backoff while the backend is down (bounded sending_queue), and holds the backend address and key.

                                                                  Typical resultThe app only knows localhost. Batching, retries and the backend settings live in the collector, so a backend outage or a switch to another backend is handled in the sidecar without a new release of the app.

                                                                  Seen on

                                                                  • Kubernetes docs: Sidecar containers run next to the main app container in the same Pod and add things like logging, monitoring or data sync without changing the app's code; they share its network and storage.
                                                                  • Azure Architecture Center: Describes the Sidecar pattern: helper tasks such as monitoring, logging and proxies run in a separate container next to each app instance and share its life cycle.
                                                                  • OpenTelemetry docs: The agent pattern runs a Collector next to the app, for example as a sidecar; the app sends its telemetry to the Collector, which sends it on to one or more backends.

                                                                  You might describe it as

                                                                  • a helper container that rides along with the app
                                                                  • the app talks to localhost and the helper does the rest
                                                                  • ship the logs without touching the app's code

                                                                  Not to be confused with

                                                                  • Container image

                                                                    A container image is what a container starts from; a sidecar is a second container in the same pod that helps the main one.

                                                                  • Secrets manager

                                                                    A sidecar is a helper container in the same pod as the app; a secrets manager is the service that stores and hands out secrets, and a sidecar is one common way to fetch them for the app.

                                                                  Consistency 0 / 6

                                                                  Keeping data right as it moves between services.

                                                                  Change data capture (CDC)

                                                                  Also called: CDC.

                                                                  Update a customer and watch the change travel from the database log to the search index. Stop the connector, update twice, then press Stop the connector again to restart it.

                                                                  Updates: 0 · Connector position: 101 · Waiting in the log: 0

                                                                  Customer 7 lives in Lisbon. The connector has read the log up to entry 101.

                                                                    Connector running

                                                                    A connector reads every committed change (insert, update, delete) from the database's own log and publishes each one as an event, for example to Kafka. It saves how far it has read, and the database keeps its log from that point on (in Postgres, while the connector's replication slot is kept), so after a stop it carries on and misses nothing. Other systems, like a search index or a cache, stay in sync by reading the events, with no change to the app's code.

                                                                    Say it in a prompt

                                                                    Stream changes from the Postgres customers table to the search index with Debezium. Set wal_level=logical, give the connector its own replication slot with the pgoutput plugin, and publish change events to the Kafka topic shop.public.customers, keyed by customer id. A sink applies each event to the customers index in order. After a stop the connector resumes from its saved position; alert when the slot holds back more than 10 GiB of WAL.

                                                                    Vague vs precise prompt

                                                                    Vague prompt

                                                                    keep the search index up to date with the customers table

                                                                    Typical resultAdds a call to the search service after each save in the app. Changes made by other code paths, scripts or manual SQL never reach the index, and when the search service is down the update is simply dropped, so the index slowly drifts away from the database.

                                                                    Precise prompt

                                                                    Use change data capture: a Debezium Postgres connector reads the customers table's changes from the WAL through a replication slot and publishes them to the Kafka topic shop.public.customers; a sink applies them to the search index in order. After a stop, resume from the saved position.

                                                                    Typical resultEvery committed change reaches the index, including ones from scripts and manual SQL, with no change to the app. When the connector or the index is down, the changes wait in the log or in Kafka and are applied in order when it comes back.

                                                                    Seen on

                                                                    • Debezium docs: The PostgreSQL connector uses logical decoding and a replication slot to read committed changes from the write-ahead log, and sends one change event per row insert, update or delete to a Kafka topic per table. After a stop it continues reading the WAL where it left off.
                                                                    • PostgreSQL docs: Logical decoding turns the write-ahead log into a stream of row changes. A replication slot keeps the WAL its consumer hasn't read yet, so it can pick up where it stopped; after a crash some recent changes may be sent again.
                                                                    • PostgreSQL docs: Every change is written to the write-ahead log before the table files, and a transaction counts as committed once its log records are on disk.

                                                                    You might describe it as

                                                                    • stream every database change out as events
                                                                    • keep the search index in sync without touching the app
                                                                    • read the database's own log of changes

                                                                    Not to be confused with

                                                                    • Transactional outbox

                                                                      Change data capture reads every committed change from the database's log, whether or not the app meant to announce it; an outbox is the app writing an event row on purpose, in the same transaction as the change.

                                                                    • Webhook

                                                                      A webhook is one app calling another app's URL when something happens; change data capture reads every committed change from the database log, even ones no code announced.

                                                                    Durable workflow

                                                                    Also called: durable execution.

                                                                    The engine keeps an event history of every finished step. Here a step's timeout, which tells the engine a worker is gone, is shortened to half a second.

                                                                    No run yet. Run the workflow, then crash the worker in step 3 to see what the history saves.

                                                                      No run yet

                                                                      A job of several steps, run by an engine that writes each finished step's result into an event history. If the worker running it crashes, a new worker replays that history, skips the steps already done and carries on from the step that was cut off. That step may run a second time, so a step with a side effect, like sending an email, must be safe to repeat.

                                                                      Say it in a prompt

                                                                      Run the investor signing flow as a Temporal workflow with 4 activities: sign the document, make the PDF, email the investor, update the dashboard. Give each activity a 30 s start-to-close timeout and a retry policy (1 s first wait, doubling, at most 5 attempts). Make the email activity idempotent with a key made of the workflow run ID and the activity ID, so a retry after a crash never emails the investor twice. Keep the workflow code deterministic: no clock, random numbers or network calls outside activities.

                                                                      Vague vs precise prompt

                                                                      Vague prompt

                                                                      send the signed PDF to the investor in a background job

                                                                      Typical resultPuts all 4 steps in one job on a queue. When the worker restarts during a deploy, the job runs again from the top: the document is signed twice and the investor gets 2 emails.

                                                                      Precise prompt

                                                                      Run it as a Temporal workflow: 4 activities with retries, each result kept in the event history, and the email sent with an idempotency key of run ID plus activity ID. Keep the workflow code deterministic: no clock, random numbers or network calls outside activities.

                                                                      Typical resultAfter a crash a new worker carries on at the step that was cut off, the steps already done do not run again, and the investor gets 1 email, even though the email step ran twice.

                                                                      Seen on

                                                                      • Temporal docs: The event history is a complete, durable log of everything that happened in a workflow execution. After a worker crashes, the history is used to replay the code and rebuild the workflow's state as it was just before the crash.
                                                                      • Microsoft Learn (Durable Task): Orchestrations use event sourcing: every step is appended to an execution history. On replay, a step the history shows as complete is not run again; its saved result is used and the code moves on.
                                                                      • Temporal docs: Activities may be retried and can even partly run more than once, so they should be idempotent. The workflow run ID plus the activity ID makes a good idempotency key: the same on every retry, unique for each run.

                                                                      You might describe it as

                                                                      • a job that picks up where it left off after a crash
                                                                      • long multi-step process that survives a server restart
                                                                      • remember which steps already ran

                                                                      Not to be confused with

                                                                      • Saga

                                                                        A durable workflow is a job whose engine remembers which steps are done; a saga is a pattern, a chain of steps with an undo for each, and sagas are often built as one.

                                                                      • Retry with backoff

                                                                        A durable workflow remembers which steps are done, so after a crash it retries only the step that was cut off; retry with backoff tries one failed call again, waiting longer each time.

                                                                      Eventual consistency

                                                                      Also called: eventually consistent.

                                                                      Change the name saves it in the users DB. The search index gets it 0.8 s later, the orders copy 2.2 s later, and the cache (another team's, so it can only expire) when its 2 s TTL runs out. Keep editing sends 4 changes. Reading the profile from the source is always new, but slower.

                                                                      Reads: 0 · Old answers: 0 · Profile read: 5 ms · On the users DB: 0

                                                                      Every copy says "Sam". Change the name and watch each copy catch up at its own pace.

                                                                        All copies: Sam

                                                                        A promise that the copies of some data (a cache, a search index, another service's table) may disagree for a while after a write, usually a short while, but all agree once writes stop. Until then, a screen that reads one copy can show the old value. When a read must see the latest write, it reads from the source, which is slower and puts the load on one place.

                                                                        Say it in a prompt

                                                                        When a user renames themselves in the users service, publish a UserRenamed event. The search indexer and the orders service update their own copies from it. The profile cache belongs to another team and hears no events, so we can't delete its key on write as cache-aside would; it keeps entries for 2 seconds (TTL). Accept that screens can show different names for a few seconds. On the profile page only, read the name from the users service so the person sees their change right after saving; other screens keep reading their copies. Add a nightly job that compares each copy with the users table and fixes any that drifted.

                                                                        Vague vs precise prompt

                                                                        Vague prompt

                                                                        make sure the new name shows up everywhere right away

                                                                        Typical resultMakes every screen read the users service directly. Pages get slower and every read lands on one database, and the search index and the other services still show the old name for a while anyway.

                                                                        Precise prompt

                                                                        Publish UserRenamed when a name changes; search and orders update their copies from it, and the profile cache (another team's, so it can only expire) has a 2 s TTL. On the profile page only, read the name from the users service. A nightly job compares the copies with the users table and fixes drift.

                                                                        Typical resultMost screens stay fast and read their own copy. The person who renamed sees the new name at once, other screens catch up within seconds, and a copy that missed an event is fixed by the nightly job.

                                                                        Seen on

                                                                        • All Things Distributed (Werner Vogels): Defines eventual consistency: if no new updates are made to an object, eventually all accesses return the last updated value. The time before that is called the inconsistency window.
                                                                        • Amazon DynamoDB docs: Reads are eventually consistent by default and may not show a write that just finished; a read repeated a short time later should. A strongly consistent read (ConsistentRead: true) returns the latest data.
                                                                        • etcd docs: Linearizable (strong) reads go through consensus, so they have higher latency and lower throughput; serializable reads are faster but may return stale data.

                                                                        You might describe it as

                                                                        • all the copies will match in a moment
                                                                        • two screens show different names for a few seconds
                                                                        • fine to be a bit out of date, as long as it catches up

                                                                        Not to be confused with

                                                                        • Read model

                                                                          Eventual consistency is a promise about every copy of some data, that they agree once writes stop; a read model is one kind of copy, and it usually keeps that promise.

                                                                        • Read replica

                                                                          Eventual consistency covers every kind of copy, from caches and search indexes to other services' tables; a lagging read replica is just one reason two copies disagree.

                                                                        Read model

                                                                        Also called: CQRS read side, projection, query model.

                                                                        Open the dashboard reads order_summaries, a table made for this screen. The old way joins 3 tables on the write side. Placing an order shows the read model's lag (1 s here, slowed down).

                                                                        Rows read: 0 · Query time: none yet · Projector: up to date

                                                                        The dashboard shows the 3 biggest orders this month, out of 2,000 orders.

                                                                          No reads yet

                                                                          A separate copy of your data, shaped for one screen or one question, apart from the tables you write to. Usually a projector takes each change from the write side and updates it (some are rebuilt on a schedule instead), so a page reads ready-made rows with no joins. It is fast to read, but it can be a moment behind the latest write.

                                                                          Say it in a prompt

                                                                          Add an order_summaries read model for the orders dashboard: one row per order with month, customer_name, item_count and total, indexed on (month, total). A projector consumes OrderPlaced and OrderChanged events and upserts the row by order_id, so a repeated event does no harm. The dashboard reads only order_summaries, with no joins on the write tables. Alert if the projector falls more than 5 seconds behind.

                                                                          Vague vs precise prompt

                                                                          Vague prompt

                                                                          the orders dashboard is slow, make it faster

                                                                          Typical resultAdds indexes and caches the slow query for a minute. The dashboard still joins orders, customers and order_items on the database that takes every checkout, and the cache shows old totals with no rule for when they change.

                                                                          Precise prompt

                                                                          Add an order_summaries read model (order_id, month, customer_name, item_count, total), filled by a projector that consumes OrderPlaced events and upserts by order_id. The dashboard reads only order_summaries. Alert if the projector lags more than 5 s.

                                                                          Typical resultThe dashboard reads 3 ready rows in a few milliseconds and puts no load on the write tables. A new order shows up as soon as the projector applies its event, and the lag is measured and alerted on.

                                                                          Seen on

                                                                          • Martin Fowler: CQRS means using one model to update information and a different model to read it. Having separate models makes eventual consistency more likely.
                                                                          • Azure Architecture Center: The CQRS pattern: a common way to keep the read side in sync is for the write model to publish events that the read model uses to refresh its store. That store can hold a materialized view that avoids complex joins, and it may not show the newest changes at once.
                                                                          • Azure Architecture Center: The Materialized View pattern: build a read model ahead of time in the shape a query needs, like a sales summary a dashboard reads instead of combining orders, order items and customers on every request.

                                                                          You might describe it as

                                                                          • a table made just for the dashboard
                                                                          • work out the totals ahead so the page has nothing to join
                                                                          • the list page reads its own copy, shaped for it

                                                                          Not to be confused with

                                                                          • Read replica

                                                                            A read model is a new table you design for one screen and fill from events with your own code; a read replica is the whole database copied as it is, so the same joins still run there.

                                                                          • Eventual consistency

                                                                            A read model is a table built so one screen reads fast; it is usually eventually consistent, so right after a write it can miss the change for a moment.

                                                                          Saga

                                                                          Also called: saga pattern.

                                                                          Each service saves its own step in its own database, so nothing can roll all three back. When a step fails, the trip service undoes the steps that worked, usually newest first.

                                                                          Booked: 0 · Cancelled: 0 · Half-done: 0

                                                                          No trip yet. Book a trip to see the 3 steps, or book when flights are full to see them undone.

                                                                            No trip yet

                                                                            A way to do one business action across several services, each with its own database, as a chain of steps. Each step commits on its own, so there is no rollback across them. If a later step fails, the saga runs an undo step (a compensation) for each step that already worked, usually newest first, so nothing is left half-done.

                                                                            Say it in a prompt

                                                                            Book trips as an orchestrated saga in the trip service: reserve the hotel, put a $480 hold on the card with Stripe, book the flight, and only then capture the payment. Put steps that can't be undone last. If a step fails, run the compensations in reverse order: release the hold, then cancel the hotel. Save the saga's state in a trip_sagas table after every step, retry each compensation until it succeeds, and send every call with an idempotency key made of the trip ID and the step.

                                                                            Vague vs precise prompt

                                                                            Vague prompt

                                                                            book the hotel, payment and flight together

                                                                            Typical resultCalls the three services one after another in one request handler and charges the card first. When the flight call fails, the money is taken and the room stays reserved, and someone has to fix it by hand.

                                                                            Precise prompt

                                                                            Run the booking as a saga: reserve the hotel, hold $480 on the card, book the flight, then take the money. If a step fails, release the hold, then cancel the hotel, retrying each undo until it succeeds.

                                                                            Typical resultA full flight ends with the trip cancelled, the hold released and the room freed, with no money taken, and the trip_sagas table shows which step each trip reached.

                                                                            Seen on

                                                                            • microservices.io: Describes a saga as a sequence of local transactions in different services; if one fails, compensating transactions undo the changes the earlier ones made. A saga is coordinated either by choreography (events) or by an orchestrator.
                                                                            • Azure Architecture Center: The saga pattern page: each local transaction commits in its own service, compensating transactions reverse the completed steps when a later one fails, steps should be idempotent so they can be retried, and a compensation can fail too.

                                                                            You might describe it as

                                                                            • release the card hold if the flight can't be booked
                                                                            • a booking across several services that cancels cleanly
                                                                            • each service takes back its own part when a later step fails

                                                                            Not to be confused with

                                                                            • Durable workflow

                                                                              A saga is a pattern, a chain of steps with an undo for each; a durable workflow is a job whose engine remembers which steps are done, and sagas are often built as one.

                                                                            Transactional outbox

                                                                            Also called: outbox pattern.

                                                                            Place an order: one transaction saves it and its event. Crash before publish stops the relay (press it again to restart it); Try a dual write shows the old way, with no outbox.

                                                                            Orders saved: 0 · Events in Kafka: 0 · Waiting in outbox: 0 · Lost: 0

                                                                            No orders yet. The relay reads the outbox and publishes each event to Kafka.

                                                                              No orders yet

                                                                              Save the event you want to send as a row in an outbox table, in the same database transaction as the change itself. A separate relay reads the unsent rows, publishes them to the message broker and marks them sent. The change and its event are saved together or not at all, so a crash can delay an event but never lose it, though it may send it twice.

                                                                              Say it in a prompt

                                                                              When the Orders API creates an order, insert the order row and an OrderPlaced row into an outbox table (id, order_id, type, payload, created_at, sent_at) in the same Postgres transaction. A relay polls every 500 ms for rows where sent_at is null, oldest first, publishes each to the Kafka topic orders keyed by order id, and sets sent_at only after Kafka acknowledges. After a crash the relay can publish a row twice, so consumers skip event ids they have already handled. A cleanup job deletes rows sent more than 7 days ago.

                                                                              Vague vs precise prompt

                                                                              Vague prompt

                                                                              when an order is placed, send an OrderPlaced event to Kafka

                                                                              Typical resultSaves the order, then calls the Kafka producer on the next line. If the app crashes or Kafka is down between the two, the order exists but no event is ever sent, so the warehouse never ships it. If the publish works but the save rolls back, an event goes out for an order that doesn't exist.

                                                                              Precise prompt

                                                                              Use a transactional outbox: insert the order and an OrderPlaced row into the outbox table in one transaction. A relay publishes unsent rows to the Kafka topic orders, oldest first, and marks each sent after Kafka acknowledges. Consumers skip event ids they've already handled.

                                                                              Typical resultEvery saved order gets its event, even when the relay or Kafka is down for a while: the row waits in the outbox and goes out when the relay can publish. A rolled-back order sends no event, and an event sent twice is handled once.

                                                                              Seen on

                                                                              • microservices.io: Describes the pattern: the service stores its messages in a database table in the same transaction as its business data, and a separate message relay sends them to the broker. The relay may publish a message more than once, so consumers should be idempotent.
                                                                              • AWS Prescriptive Guidance: Explains the dual write problem (a database update and an event that can fail apart) and the fix: write the outbox row in the same transaction, and let another process send it to the queue.
                                                                              • Azure Architecture Center: Shows an ordering service whose event is lost when an error comes between saving the order and publishing it, and how saving the event in the same transaction, then relaying it and marking it processed, prevents that.

                                                                              You might describe it as

                                                                              • save the order and its message in one go
                                                                              • never lose the event if the app crashes after saving
                                                                              • a table of messages still waiting to be sent

                                                                              Not to be confused with

                                                                              • Change data capture (CDC)

                                                                                An outbox is the app writing an event row on purpose, in the same transaction as the change; change data capture reads every committed change from the database's own log. They often work together, with a CDC connector as the relay that reads the outbox table.

                                                                              • Queue

                                                                                A queue holds work until a consumer takes it; an outbox is a table in the sender's own database that makes sure the message gets to the queue at all.

                                                                              Security and access 0 / 6

                                                                              Who may see what, and where data may live.

                                                                              API gateway

                                                                              The key says which client is calling; the token proves who. The gateway checks both, then the limit (5 per second per key), then routes by path. Send with no key or token, or send 10 at once to pass the limit. Each partner press starts a new second.

                                                                              Reached Orders: 0 · Reached Users: 0 · 401 at the gateway: 0 · 429 at the gateway: 0

                                                                              Every caller uses one address, the gateway. The Orders and Users services sit behind it.

                                                                                No requests yet

                                                                                One front door for many backend services: every client calls the gateway's address, never the services behind it. Before a request goes on, the gateway checks its API key (which client is calling, though a key built into an app can be pulled out of it) and its token (proof of who is calling), counts it against that client's rate limit, and routes it by its path, so requests that fail a check stop there. Run at least 2 gateway instances so it is not a single point of failure, and let each service still verify the token too, in case a gateway route is wrong or bypassed.

                                                                                Say it in a prompt

                                                                                Put an API gateway in front of the Orders and Users services, and run at least 2 gateway instances behind a load balancer so it is not a single point of failure. Route /orders/* to the Orders service and /users/* to the Users service. On every request check the x-api-key header, which says which client is calling, and the Authorization bearer token (a signed JWT that has not expired), which proves who is calling; answer 401 without calling any service when either is missing or invalid. Limit each key to 5 requests per second and answer 429 with a Retry-After header above that. Keep both services on a private network that only the gateway can reach, and verify the token again inside each service.

                                                                                Vague vs precise prompt

                                                                                Vague prompt

                                                                                let our partners call our services

                                                                                Typical resultGives each service its own public address and adds a key check to the one the partner asked about. Partners must know every address, the other services accept any request, and one partner's runaway script can flood them all.

                                                                                Precise prompt

                                                                                Put 2 API gateway instances in front of the Orders and Users services: route /orders/* and /users/* by path, check the x-api-key header and the bearer token and answer 401 at the gateway when either is missing or invalid, limit each key to 5 requests per second with 429 and Retry-After, and keep the services on a private network only the gateway can reach.

                                                                                Typical resultPartners call one address, and one gateway instance can fail without taking the API down. Requests with no valid key or token, or over the limit, stop at the gateway with 401 or 429, so the services only see allowed traffic, and moving a service only changes one route. Each service still verifies the token, in case a request gets past the gateway.

                                                                                Seen on

                                                                                • Azure Architecture Center: An API gateway is a central entry point that acts as a reverse proxy and routes client requests to the right services. It can also take on shared jobs such as authentication, SSL termination and rate limiting.
                                                                                • Azure Architecture Center, Gateway Routing pattern: Clients call one endpoint and the gateway routes each request by its URL to the right service. It warns that the gateway can become a single point of failure, and suggests making the services reachable only through it.
                                                                                • microservices.io: The API gateway pattern: a single entry point for all clients that routes requests to the right service or fans out to several, and can check that the client is allowed to make the request.
                                                                                • Amazon API Gateway: Usage plans use API keys to tell clients apart and throttle each key's requests. The docs warn not to use API keys alone for authentication or authorization.

                                                                                You might describe it as

                                                                                • one place to check keys, tokens and limits for every API
                                                                                • stop requests without a key before they reach our services
                                                                                • send /orders to one service and /users to another

                                                                                Not to be confused with

                                                                                • Load balancer

                                                                                  An API gateway adds per-client checks in front of your services, such as keys, tokens and rate limits; a load balancer's main job is spreading requests over healthy copies of a service, though many can also route by path.

                                                                                • Rate limiting

                                                                                  An API gateway is a place where rate limiting often runs, next to checking keys and routing by path; rate limiting is that one job, capping how many requests each client may make.

                                                                                Data residency

                                                                                The router keeps a directory: customer id → home region. Sign up an EU or a US customer, then run a report on everyone. The same rule must cover backups, logs and support access, not only the database.

                                                                                EU database: 1,240 profiles · US database: 860 profiles · Totals out of the EU: 0

                                                                                Each customer's profile lives in one home region. The router's directory says which.

                                                                                  No sign-ups yet

                                                                                  Keeping each customer's data in a chosen place, such as the EU, and not letting it move out. A router sends each customer to their home region, every copy of their data stays in that place too (logs, search indexes, and backups kept in a second EU cloud region), and a report on everyone runs inside each region and sends out only totals for groups of at least 10 people. Laws such as the GDPR may limit when personal data can leave a region, and contracts may require it to stay, so ask your legal team which rules apply to you.

                                                                                  Say it in a prompt

                                                                                  Store each customer's data only in their home region: EU customers in eu-west, US customers in us-east. Keep a global directory that maps customer id to home region and holds no names or emails, and route every request through it. Give each region's database credentials that only that region's services hold, so us-east cannot read eu-west. Keep logs and search indexes in the same region, and back up eu-west to a second EU region, not to the US. Check third-party tools too (error tracking, email, analytics), since they often copy customer data to other countries. Reports on everyone run inside each region and return only totals for groups of at least 10 people. Let only support staff approved for a region see its data, and check the design with our legal team.

                                                                                  Vague vs precise prompt

                                                                                  Vague prompt

                                                                                  EU customers' data needs to stay in Europe

                                                                                  Typical resultAdds a second database in an EU region and writes EU sign-ups to it. Backups, logs, the search index and the nightly analytics export still go to the US region, so copies of EU data leave the EU every day.

                                                                                  Precise prompt

                                                                                  Give each customer a home region: EU in eu-west, US in us-east. A directory maps customer id to region (no names or emails) and the router sends every request there. Each region's database only accepts its own region's credentials. Logs and indexes stay in the region, eu-west backs up to a second EU region, and reports run per region and return only totals for groups of at least 10.

                                                                                  Typical resultEach EU customer's profile, logs and backups stay in the EU, the report still covers everyone through per-region totals, and a job in us-east that tries to read EU rows is refused by the database. Your legal team can then check the design against the rules that apply.

                                                                                  Seen on

                                                                                  • European Commission: Under the GDPR, personal data sent outside the European Economic Area must keep its protection, through tools such as adequacy decisions, standard contractual clauses or binding corporate rules.
                                                                                  • AWS: Customers choose the AWS Regions where their content is stored. AWS says it won't move or copy that content out of those Regions except to provide the service the customer started or to comply with the law, and customers may back it up in other Regions themselves.
                                                                                  • Google Cloud: Data residency describes where data is stored at rest. Its commitments cover customer data in services that can be set to a location, and not resource names or labels, so some data falls outside them.

                                                                                  You might describe it as

                                                                                  • keep EU customers' data in the EU
                                                                                  • this customer's data must not leave their country
                                                                                  • give every customer a home region

                                                                                  Not to be confused with

                                                                                  • Sharding

                                                                                    Data residency splits data by where the law or a contract says it may live, so a customer's rows stay in their region; sharding splits data to spread the load. Residency is often built with sharding, using the home region as the shard key.

                                                                                  Relationship-based access (ReBAC)

                                                                                  Also called: ReBAC, relationship-based access control.

                                                                                  The main button asks the permission service whether Ana can view memo.pdf; it follows the tuples from the file to Ana. Remove Ana from the team and Share the file with Ben each change one tuple and check again (press either again to undo it).

                                                                                  Tuples: 3 · Checks: 0 · Hops: 0

                                                                                  Three tuples link Ana to memo.pdf: she is in deal-team, the team edits fund-a, and fund-a holds the file.

                                                                                    No checks yet

                                                                                    Access is worked out from stored relationships, such as "Ana is a member of deal-team", "deal-team edits the folder fund-a" and "fund-a holds memo.pdf". To answer "may Ana view memo.pdf?", a permission service follows those links from the file until it reaches Ana, or answers no. Sharing or removing access means writing or deleting one relationship, with no change to the file or to the app's code.

                                                                                    Say it in a prompt

                                                                                    Add relationship-based access with OpenFGA. Model the types user, team, folder and file: a team has members; a folder has editors (users or team#member) and viewers, and every editor is also a viewer; a file has a parent folder and viewers, and the viewers of its parent may view it too. Write a tuple when someone joins a team, a folder is shared or a file is created. Before showing or downloading a file, call Check(user, viewer, file) and deny when it says no or the call fails; a route that never calls Check is open, so add a test that every file route does. To list a folder, call ListObjects(user, viewer, file) instead of one Check per file. Test that Ana is allowed through deal-team, and denied once she leaves it.

                                                                                    Vague vs precise prompt

                                                                                    Vague prompt

                                                                                    let people share folders and files with their team

                                                                                    Typical resultAdds a shared_with list on each file and checks it in the download route. Sharing a folder doesn't reach the files in it, leaving a team changes nothing, and each screen checks access in its own slightly different way.

                                                                                    Precise prompt

                                                                                    Use relationship-based access with OpenFGA: tuples for team members, folder editors and each file's parent folder, and a model where a folder's editors may view its files. Every file route calls Check(user, viewer, file) first. Leaving a team deletes one tuple.

                                                                                    Typical resultJoining or leaving a team, or sharing one file, is a single tuple write, and every screen asks the same service, so access is the same everywhere. It only guards the routes that ask: a route that skips Check is still open, and folder listings need ListObjects. A test shows Ana allowed through her team, then denied once she leaves it.

                                                                                    Seen on

                                                                                    • Google Research: Zanzibar, Google's authorization system, keeps access rules as relationships in one data model and config language, and answers millions of checks a second over trillions of access control lists.
                                                                                    • OpenFGA docs: A relationship tuple is a user, a relation and an object, like user:anne editor document:new-roadmap. A check asks whether a user has a relation with an object and answers allowed true or false.
                                                                                    • OpenFGA docs: An editor of a folder can be made an editor of every document whose parent is that folder, with no tuple for each document.
                                                                                    • OpenFGA docs: A relation can be given to a whole team with team:writers#member, so everyone in the team has it.
                                                                                    • OpenFGA docs: ListObjects returns every object of one type that a user has a given relation with, for screens like all the documents a user can read.
                                                                                    • SpiceDB docs: A permission check asks whether a chain of relationships leads from the resource to the user, so access questions become questions of reaching one point in a graph from another.

                                                                                    You might describe it as

                                                                                    • share one file with one person without opening the whole folder
                                                                                    • access that follows teams, folders and files
                                                                                    • ask one service "may this user do this?" before every action

                                                                                    Not to be confused with

                                                                                    • Row-level security (RLS)

                                                                                      Row-level security filters the rows of a table inside one database, by a rule on each row; ReBAC answers "may this user do this to this object?" from stored relationships, for any service and any kind of object.

                                                                                    • Audit log

                                                                                      ReBAC decides whether an action is allowed before it happens; an audit log records who did what after it happened.

                                                                                    Row-level security (RLS)

                                                                                    Also called: RLS.

                                                                                    Ana lists deals: the app sets her fund and runs a query with no WHERE. Ben lists deals does the same for Fund B. Turn RLS off shows what that missing WHERE leaks (press it again to turn RLS back on).

                                                                                    Rows in table: 6 · Rows returned: 0 · RLS on

                                                                                    Fund A and Fund B share one deals table. The app's query has no WHERE; a policy decides which rows each user gets.

                                                                                      RLS on

                                                                                      The database decides which rows each query may see, using a policy on the table such as "fund_id must match this request's fund". The app can run SELECT * FROM deals with no WHERE and still get only its own fund's rows, because Postgres checks the policy on every row. It is a second lock, not a replacement for the app's own checks: superusers skip it, the table's owner skips it unless the table uses FORCE, and if the app sets the wrong fund the policy returns that fund's rows.

                                                                                      Say it in a prompt

                                                                                      Turn on row-level security for the Postgres deals table, with one policy: USING (fund_id = current_setting('app.fund_id', true)) and the same WITH CHECK, so a user can neither read nor write another fund's rows, and a missing setting gives no rows instead of an error. If fund_id is a uuid, use NULLIF(current_setting('app.fund_id', true), '')::uuid instead: on a pooled connection that has used the setting before, an unset value reads as '' rather than NULL. Add an index on deals(fund_id). The app connects as app_user, which is not the table's owner and has no BYPASSRLS; also run ALTER TABLE deals FORCE ROW LEVEL SECURITY. Each request opens a transaction and runs SET LOCAL app.fund_id to the signed-in user's fund before any query, so COMMIT clears it before the connection goes back to the pool. Keep the app's own permission checks. Add a test that Ana (Fund A) gets 3 of the 6 seeded deals.

                                                                                      Vague vs precise prompt

                                                                                      Vague prompt

                                                                                      make sure each fund only sees its own deals

                                                                                      Typical resultAdds WHERE fund_id = ? to the deals queries in the app. Every new query, report and script has to remember it, the one that forgets returns every fund's deals, and nothing in the database stops it.

                                                                                      Precise prompt

                                                                                      Enable row-level security on deals with a policy USING (fund_id = current_setting('app.fund_id', true)) and the same WITH CHECK, and index deals(fund_id). Connect as app_user (not the owner, no BYPASSRLS), FORCE ROW LEVEL SECURITY, and SET LOCAL app.fund_id inside each request's transaction. Keep the app's own checks too.

                                                                                      Typical resultA query that forgets its WHERE still returns only the current fund's rows, and writes to another fund's rows fail. The app still checks permissions itself, and a test proves Ana sees 3 of the 6 deals.

                                                                                      Seen on

                                                                                      • PostgreSQL docs: With row security on, every query on the table must pass a policy, and with no policy no rows are visible. Superusers and roles with BYPASSRLS always skip it; the table's owner does too, unless the table is set to FORCE ROW LEVEL SECURITY.
                                                                                      • PostgreSQL docs: A policy's USING expression is added to queries on the table. Rows where it is not true are left out silently, with no error.
                                                                                      • PostgreSQL docs: current_setting() reads a setting's value; with missing_ok set to true, a missing setting gives NULL instead of an error. set_config() with is_local set to true changes a setting only for the current transaction.
                                                                                      • PostgreSQL docs: SET LOCAL lasts only until the end of the current transaction, committed or not. Outside a transaction it only gives a warning and does nothing.
                                                                                      • PostgreSQL docs: Postgres accepts a setting with a two-part name, like app.fund_id, even when no extension defines it.
                                                                                      • Supabase docs: Enable RLS on every table in an exposed schema, and think of a policy as a WHERE clause added to every query. The secret key uses a role with BYPASSRLS, so it must never reach the browser.

                                                                                      You might describe it as

                                                                                      • let the database hide other customers' rows
                                                                                      • a filter on the table that every query has to pass
                                                                                      • one fund must never see another fund's data, even if the app forgets a WHERE

                                                                                      Not to be confused with

                                                                                      • Relationship-based access (ReBAC)

                                                                                        ReBAC answers "may this user do this to this object?" from stored relationships, for any service; row-level security filters the rows of one table inside the database, by a rule on each row.

                                                                                      Secrets manager

                                                                                      Also called: secret store.

                                                                                      Start the app, then rotate the password (time is shortened): each lease is a new database user (dynamic secrets), with no redeploy. A stored password can instead be changed on a schedule. Then bake it into the image, the old way. The pod logs in with its Kubernetes identity, so it needs no password.

                                                                                      Clock: 09:00 · Leases: 0 · Revoked: 0 · Rebuilds: 0

                                                                                      The app needs a database password. It isn't in the code or the image: it has to ask for it.

                                                                                        No app yet

                                                                                        A service that stores passwords, API keys and other secrets, and hands each one at run time only to the apps allowed to have it. It can change stored passwords on a schedule (rotation) or make short-lived ones on demand (dynamic secrets), so nothing secret sits in the code, the config or the image. The app still has to prove who it is to the manager, usually with an identity its platform gives it, such as a Kubernetes service account, so whoever controls the running pod can read its credentials; short leases limit the damage.

                                                                                        Say it in a prompt

                                                                                        Give the shop API its Postgres login from HashiCorp Vault, not from the image or an env file. The pod logs in to Vault with its Kubernetes service account shop-api (the kubernetes auth method) and reads database/creds/shop, which creates a Postgres user with a 1-hour lease (default_ttl=1h, max_ttl=24h). Get new credentials before the lease ends, reconnect with them, and let Vault revoke the old user. Never log the password.

                                                                                        Vague vs precise prompt

                                                                                        Vague prompt

                                                                                        connect the app to the production database

                                                                                        Typical resultPuts the database password in the code, in a .env file copied into the Docker image, or in a build argument or ENV line. Deleting the file in a later layer still leaves it in the earlier one, and the image history shows build arguments and ENV. Anyone who can read the repo or pull the image has the password, and changing it means a rebuild and a redeploy of every service that uses it.

                                                                                        Precise prompt

                                                                                        Get the Postgres login from Vault at start-up: log in with the pod's Kubernetes service account, read database/creds/shop with a 1-hour lease, get new credentials before it ends, and never log the password.

                                                                                        Typical resultNo password in the code, the image or an env file. Each pod gets its own short-lived database user; a new one takes over before the lease ends and the old one is revoked, with no rebuild or redeploy.

                                                                                        Seen on

                                                                                        • HashiCorp Vault docs: The database secrets engine creates database credentials on demand, a different user for each client, and revokes the user when its lease ends, so services no longer hard-code a password. The docs' example role sets a 1-hour lease (default_ttl=1h).
                                                                                        • HashiCorp Vault docs: With the Kubernetes auth method a pod logs in with its service account token, and Vault checks that token with the Kubernetes TokenReview API, so the pod needs no stored password to get its secrets.
                                                                                        • AWS Secrets Manager docs: Replace hard-coded credentials with a call to Secrets Manager at run time. Because the credentials no longer live with the application, rotating them needs no update or redeploy of the application.
                                                                                        • Kubernetes docs: A Secret keeps a password or token out of the Pod spec and the container image, but by default it is stored unencrypted in etcd. The docs advise encryption at rest, tight access rules and, where needed, an external secret store.

                                                                                        You might describe it as

                                                                                        • keep the database password out of the code and the image
                                                                                        • change the password without a redeploy
                                                                                        • the app fetches its credentials when it starts

                                                                                        Not to be confused with

                                                                                        • Sidecar

                                                                                          A sidecar is a helper container in the same pod; a secrets manager is the service that stores and hands out secrets, and a sidecar is one common way to deliver them to the app.

                                                                                        Signed URL

                                                                                        Also called: pre-signed URL, presigned URL.

                                                                                        Download the report, then use the same link after 5 minutes (the wait is shortened here), or change one character in it. A signed URL works for anyone who has it until it expires, so keep the expiry short and don't log it.

                                                                                        Downloads: 0 · Refused: 0 · Bytes through the app: 0

                                                                                        Ana wants the Q3 report. It sits in a private bucket: no public link can reach it.

                                                                                          No link yet

                                                                                          A link to one private file that carries its own permission: an expiry time and a signature made with your app's credentials. Your app checks the user and signs the link; the browser then downloads straight from storage, which checks the signature and the time. Anyone who has the link can use it until it expires, so keep the expiry short and never log it.

                                                                                          Say it in a prompt

                                                                                          Serve report PDFs from the private S3 bucket reports with presigned URLs. In GET /reports/:id, check that the signed-in user may read that report, then redirect the browser to a presigned GET URL for the object that expires in 5 minutes (ExpiresIn=300). Keep Block Public Access on, never stream the file through the app, and don't write the URLs to logs. Sign with credentials that outlive the link: a presigned URL also stops working when the signing role's session ends, even if a longer expiry was asked.

                                                                                          Vague vs precise prompt

                                                                                          Vague prompt

                                                                                          let users download their reports

                                                                                          Typical resultMakes the bucket public so the links work, or streams every file through the app server. A public link works for anyone, forever, once it leaks, and links leak easily: through server logs, the Referer header, browser history or a link pasted in a chat. Streaming ties up the app with every large download.

                                                                                          Precise prompt

                                                                                          Keep the reports bucket private. In GET /reports/:id check that the user may read it, then redirect to a presigned S3 URL that expires in 5 minutes. Don't log the URLs.

                                                                                          Typical resultThe app only checks the user and signs; the browser downloads the file straight from S3. A link that leaks stops working after 5 minutes, and a link with one character changed is refused with 403.

                                                                                          Seen on

                                                                                          • Amazon S3 docs: A presigned URL gives time-limited access to one object without changing the bucket policy. It can be used many times until it expires, and S3 checks the expiry when each request arrives. The docs call presigned URLs bearer tokens and say to protect them.
                                                                                          • Google Cloud Storage docs: Anyone who has a signed URL can use it while it is active, even without a Google account. The longest expiry is 7 days, so send the URL securely and pick the expiry you need.
                                                                                          • Amazon CloudFront docs: Your application checks that the user may see the file, then creates and returns a signed URL. CloudFront rejects a URL whose signature doesn't match because it was changed, then checks the expiry time.

                                                                                          You might describe it as

                                                                                          • a download link that stops working after a few minutes
                                                                                          • let the browser fetch the file straight from the bucket
                                                                                          • send a private file as a link that runs out

                                                                                          Not to be confused with

                                                                                          • CDN

                                                                                            A CDN keeps copies of files near users so they load fast; a signed URL is a short-lived permission to fetch one private file, from storage or through a CDN.

                                                                                          Shipping code 0 / 8

                                                                                          How changes get from a branch to production safely.

                                                                                          Change freeze

                                                                                          Deploy on Wednesday, before the freeze; deploy during the freeze and the pipeline blocks it; or ship an approved emergency fix, which needs a named approver.

                                                                                          Shipped: 0 · Blocked by the freeze: 0 · Exceptions: 0

                                                                                          A change freeze runs from Thursday 18:00 to Monday 09:00, for Friday's big launch. Production runs v2.3.

                                                                                            No deploys yet

                                                                                            A set window, such as the days around a big launch or a holiday, when no changes go to production: no deploys, no config or infrastructure changes, and often no feature flag flips (a deploy freeze blocks only the deploys). The deploy pipeline checks the window and blocks changes inside it, and only an urgent fix with a named approver gets an exception. A freeze doesn't make code safer, it only stops changes, so work piles up and the first deploys after it are bigger and riskier.

                                                                                            Say it in a prompt

                                                                                            Add a change freeze to our GitLab CI deploy pipeline from Thursday 18:00 to Monday 09:00 (Europe/Berlin) for Friday's launch, using a deploy freeze period: the deploy job fails with "Change freeze until Mon 09:00" whenever $CI_DEPLOY_FREEZE is set, and lock feature flag and config changes for the same window. Allow an urgent fix only through a separate manual emergency-deploy job: with GitLab Premium, put it on a protected environment that needs a deployment approval from the incident-leads group; on the free tier, make the job fail unless $GITLAB_USER_LOGIN is on the incident-leads list. Log the approver and the reason with the deploy. Ship the launch work by Wednesday so there is a day to watch it, and plan Monday's first deploys as small batches, not everything at once.

                                                                                            Vague vs precise prompt

                                                                                            Vague prompt

                                                                                            don't let anyone deploy during the launch

                                                                                            Typical resultPosts a message asking people not to deploy, or turns off the deploy job for everyone. Nothing in the pipeline checks the date, an urgent fix has no way through, nobody knows when the freeze ends, and on Monday everything that waited goes out at once.

                                                                                            Precise prompt

                                                                                            Add a deploy freeze from Thursday 18:00 to Monday 09:00 in the CI pipeline: the deploy job fails with the end time while the freeze is on, and feature flag and config changes are locked for the same window; an urgent fix ships only through a manual job approved by the incident-leads group, logged with the approver and the reason; ship the launch work by Wednesday and split Monday's deploys into small batches.

                                                                                            Typical resultDeploys, flag flips and config changes inside the window are stopped at the pipeline with a clear message; an urgent fix can still ship with a named approver on record, and the launch work has been live since Wednesday. Monday's held-back changes go out in small steps instead of one big risky deploy.

                                                                                            Seen on

                                                                                            • GitLab docs, Deploy freeze: A maintainer sets a freeze window with a start and an end written as cron entries. During the window the pipeline gets a CI_DEPLOY_FREEZE variable, and deploy jobs can be set to not run while it is there.
                                                                                            • GitLab Handbook, Production Change Lock: Production changes stop during events, major holidays and other times when fewer engineers are around; automated deploys pause. The strictest lock blocks all code deploys and all feature flag toggles, and an exception needs a written reason and a named approval.
                                                                                            • UK Ministry of Justice, Technical Guidance: Code freezes: Warns that changes get rushed out before a freeze and that the batch shipped right after it is high risk, and recommends smaller, regular changes over freezes.

                                                                                            You might describe it as

                                                                                            • no deploys over the launch weekend
                                                                                            • lock production before the holidays
                                                                                            • block deploys in a set window unless someone approves

                                                                                            Not to be confused with

                                                                                            • Feature flag

                                                                                              A change freeze stops deploys, and often flag changes too, for a set window; a feature flag lets teams deploy code switched off right up to the freeze and turn it on later, when it is safe.

                                                                                            Cherry-pick

                                                                                            Cherry-pick the fix copies one commit from main onto release/1.4 as a new commit with a new hash. Cherry-pick E (needs D) tries E alone: it changes lines D added, so on release/1.4, which lacks D, it conflicts.

                                                                                            Chips are commits, newest on the right.

                                                                                            Commits on main: 6 · on release/1.4: 3 · Picked: 0 · Conflicts: 0

                                                                                            release/1.4 needs the fix F from main, but not the features D and E.

                                                                                              release/1.4 needs the fix

                                                                                              A git command that copies the change from one commit onto another branch as a new commit, such as a fix from main onto release/1.4, without the commits around it. The copy gets a new hash, so the same change now exists twice in history; git cherry-pick -x adds a "cherry picked from commit" line to the message so you can trace it back. If the commit builds on earlier commits the branch doesn't have, the pick may conflict, or apply cleanly and then fail the build, so pick those commits too or fix the code by hand, and run the tests.

                                                                                              Say it in a prompt

                                                                                              Fix the rounding bug on main first as one small commit, then copy only that commit to release/1.4 with git cherry-pick -x <hash>, so the new commit's message says which commit it came from. Don't merge main into the release, since that would bring the unfinished features too. If the pick conflicts because the fix needs an earlier commit, stop with git cherry-pick --abort and tell me which commit it needs. Even when it applies cleanly, run the tests on release/1.4 before tagging v1.4.1, since a missing earlier commit can break the build without a conflict.

                                                                                              Vague vs precise prompt

                                                                                              Vague prompt

                                                                                              get the fix into the release

                                                                                              Typical resultMerges main into the release branch. The fix arrives, but so do the unfinished feature commits next to it, and the release now ships code nobody tested for it.

                                                                                              Precise prompt

                                                                                              Copy only commit f7e2a10, the rounding fix, from main to release/1.4 with git cherry-pick -x, so the new commit's message records where it came from. Don't merge main. If it conflicts because it needs an earlier commit, abort with git cherry-pick --abort and tell me which commit it needs.

                                                                                              Typical resultrelease/1.4 gets one new commit with the fix and a new hash, plus a "cherry picked from commit f7e2a10" line, and the features stay on main. The same change now exists twice with two hashes, so git log on each branch shows a different id for it.

                                                                                              Seen on

                                                                                              • Git documentation, git-cherry-pick: Applies the changes introduced by existing commits and records a new commit for each. The -x option appends a "(cherry picked from commit …)" line to the message; on a conflict you resolve it, then git cherry-pick --continue, or --abort to go back.
                                                                                              • trunkbaseddevelopment.com, Branch for release: A bug found in a release is fixed on trunk first, then cherry-picked to the release branch, and CI checks it there too. Fixes go one way only, from trunk to the release branch.
                                                                                              • Martin Fowler, Patterns for Managing Source Code Branches: Describes a cherry-pick as copying a commit from one branch to another without merging the branches, and warns that copied fixes are easy to forget and get harder to copy as branches drift apart.

                                                                                              You might describe it as

                                                                                              • copy just that one fix onto the release
                                                                                              • take one commit from main without the rest
                                                                                              • backport the fix to the 1.4 branch

                                                                                              Not to be confused with

                                                                                              • Release branch

                                                                                                Cherry-pick is one git command that copies a single commit onto another branch as a new commit; a release branch is the line for one release that those copied fixes often land on.

                                                                                              Feature flag

                                                                                              Also called: feature toggle.

                                                                                              Turn the flag on for 10% of users, turn it off in one step, or raise it to 100%. App v1.8 is deployed once; only the flag changes.

                                                                                              Deploys: 1 · Flag changes: 0 · New checkout: 0 of 10 users

                                                                                              App v1.8 is live with both checkouts in its code. The flag new_checkout is off, so everyone gets the old one.

                                                                                                Flag off

                                                                                                A switch the running app reads to turn one feature on or off, for everyone or for a share of users, without a new deploy: both code paths ship in the same version and the flag picks one per user. A release flag rolls a feature out, ideally by a sticky percentage so the same user always lands on the same side; turning it off is a kill switch, and long-lived ops flags are kept for just that. Each flag adds a code path to test and must be removed once the feature is fully on, or old paths pile up as flag debt.

                                                                                                Say it in a prompt

                                                                                                Put the new checkout behind a feature flag called new_checkout, using the OpenFeature SDK with flagd as the provider. Evaluate it on every request with the user id as the targeting key, so a percentage rollout is sticky per user. Start at 10% of users, watch the checkout error rate and conversion for a day, then go to 50% and 100%. Turning the flag off must send everyone back to the old checkout within 30 s with no deploy, and the old checkout is the default if the flag service can't be reached. Test both paths in CI, and open a ticket to delete the flag and the old checkout two weeks after it reaches 100%.

                                                                                                Vague vs precise prompt

                                                                                                Vague prompt

                                                                                                add the new checkout but let us turn it off if it breaks

                                                                                                Typical resultAdds an environment variable NEW_CHECKOUT that is read once at startup. Turning it off means changing the config and restarting or redeploying every pod, it is all users or none, and the old checkout code is never deleted.

                                                                                                Precise prompt

                                                                                                Put the new checkout behind an OpenFeature flag new_checkout, evaluated on every request with the user id as the targeting key; start at 10% of users, fall back to the old checkout if the flag service is down, test both paths in CI, and delete the flag two weeks after it reaches 100%.

                                                                                                Typical resultThe new checkout reaches 10% of users, the same users on every visit, and grows to 100% with no deploy. Turning the flag off sends everyone back to the old checkout within seconds, and a ticket makes sure the flag and the old code are removed instead of piling up.

                                                                                                Seen on

                                                                                                • martinfowler.com, Feature Toggles (Pete Hodgson): Feature toggles change what a system does at runtime without changing code: one deploy carries both code paths. It covers short-lived release toggles, long-lived ops toggles used as kill switches, and experiment toggles that consistently send each user down the same code path, and calls toggles inventory with a carrying cost that should be removed.
                                                                                                • OpenFeature docs, Evaluation context: The targeting key identifies the subject of a flag evaluation, such as a user, and is needed to run fractional or percentage-based rollouts deterministically.
                                                                                                • LaunchDarkly docs, Percentage rollouts: A percentage rollout hashes each context key into a bucket, so the same user keeps getting the same variation, and the percentage can be raised over time without a redeploy.

                                                                                                You might describe it as

                                                                                                • ship the code switched off and turn it on later
                                                                                                • a kill switch for the new feature
                                                                                                • turn one feature on for some users without a deploy

                                                                                                Not to be confused with

                                                                                                • Canary deploy

                                                                                                  A feature flag turns one feature on or off inside the same running version, with no deploy; a canary deploy sends a share of traffic to a new version of the whole app.

                                                                                                • Change freeze

                                                                                                  A feature flag lets code be deployed switched off and turned on later, so teams can keep shipping right up to a freeze; a change freeze stops deploys, and often flag changes too, for a set window.

                                                                                                Flaky test

                                                                                                Also called: intermittent test, nondeterministic test.

                                                                                                Run it 10 times: same commit, same test, and a save that takes longer on a busy machine. Retry until it passes turns the job green but only moves the failures into the report; Wait for the real condition removes the guess.

                                                                                                Passed: 0 · Failed: 0 · Flaky (passed on retry): 0

                                                                                                One test, one commit, not run yet. The test waits a fixed 400 ms for a toast that shows after a save.

                                                                                                  Test not run yet

                                                                                                  A test that sometimes passes and sometimes fails on the same code, because it depends on something it does not control, such as timing, the order tests run in, or the network. Retrying it until it passes turns the pipeline green but leaves the cause, and the cause may be a real race in the app, not only in the test. Fix it, or quarantine it with an owner and a date to fix it by, rather than deleting it.

                                                                                                  Say it in a prompt

                                                                                                  The Playwright test 'shows the saved toast' fails about 3 times in 10 on CI with the same commit. Reproduce it with npx playwright test --repeat-each=20, replace page.waitForTimeout(400) with await expect(page.getByRole('status')).toBeVisible(), and check whether the app itself has a race when Save is pressed twice. Don't add retries to hide it. If it can't be fixed today, tag it @quarantine and run that tag in a non-blocking CI job (or test.fixme if it must be off), with an issue that has an owner and a date.

                                                                                                  Vague vs precise prompt

                                                                                                  Vague prompt

                                                                                                  the checkout test keeps failing randomly, make CI pass

                                                                                                  Typical resultTurns on retries: 3 in the CI config, or raises the sleep from 400 ms to 2 s. The pipeline goes green, every run gets slower, and the timing bug, or a real race in checkout, is still there for the next busy machine.

                                                                                                  Precise prompt

                                                                                                  Reproduce the flaky checkout test with --repeat-each=20, replace the fixed waitForTimeout with an assertion that waits for the toast, and check the app for a race. No new retries; if it can't be fixed today, tag it @quarantine, run that tag in a non-blocking CI job, and open an issue with an owner and a date.

                                                                                                  Typical resultThe test waits for what it checks, so it passes 20 of 20 on a slow machine too. A real race, if there is one, is found instead of hidden, and a quarantined test keeps running in its own non-blocking job, with someone and a deadline to bring it back.

                                                                                                  Seen on

                                                                                                  • Martin Fowler: Non-deterministic tests sometimes pass and sometimes fail. Quarantine them in their own suite, but fix them quickly and don't abandon them; a limit, such as a week in quarantine, stops them being forgotten. Never use bare sleeps to wait for an asynchronous response: use a callback or polling.
                                                                                                  • Google Testing Blog: About 1.5% of all test runs report a flaky result, and almost 16% of tests have some flakiness: they occasionally fail in a way not caused by a change to the code or the tests.
                                                                                                  • Playwright docs: Failing tests are not retried by default. With retries on, a test that fails first and then passes on a retry is reported as flaky, not as passed.
                                                                                                  • Playwright docs: page.waitForTimeout is discouraged: tests that wait for time are inherently flaky. Use locator actions and web assertions that wait automatically.
                                                                                                  • Playwright docs: Assertions such as toBeVisible retry until they pass or the assertion timeout, 5 seconds by default, runs out.

                                                                                                  You might describe it as

                                                                                                  • a test that fails now and then for no clear reason
                                                                                                  • it goes green if I just rerun the job
                                                                                                  • red in CI but it passes on my laptop

                                                                                                  Not to be confused with

                                                                                                  • Retry with backoff

                                                                                                    Retrying a flaky test until it passes hides a bug in the test or the code; retry with backoff handles a real, temporary failure of a network call.

                                                                                                  Hotfix

                                                                                                  Also called: emergency fix.

                                                                                                  Ship a hotfix branches from the live release, makes and tests one fix, deploys it as v1.4.1, then merges the fix into main. Ship a hotfix and forget main skips that last merge, then ships release/1.5 from main.

                                                                                                  Chips are commits, newest on the right. H: the fix · M: a merge commit · Meter tick: the 1% error limit

                                                                                                  Production: v1.4.0 · Checkout errors: 12% · Fix on release/1.4: no · Fix on main: no

                                                                                                  Production runs v1.4.0 from release/1.4, and 12% of checkouts fail. main has moved on with D and E.

                                                                                                    Checkout failing

                                                                                                    A small, urgent fix shipped to the version already in production, without waiting for the next release: you start from that release's branch or tag (not from main, which holds unfinished work), make one fix, test it and deploy it as a patch such as v1.4.1. Because it skips part of the usual path, it still needs its own test and a quick review. The fix must also reach main (merged back, or made on main first and cherry-picked onto the release), or the next release, cut from main, brings the bug back.

                                                                                                    Say it in a prompt

                                                                                                    Checkout returns 500s on v1.4.0. If redeploying v1.3.2 is safe, roll back first: it stops the errors faster than any code change. Then make a hotfix: create hotfix/1.4.1 from release/1.4 (not from main), commit only the gift card total fix with a test that fails without it, run the full checkout test suite in CI and get one reviewer. Merge it into release/1.4, tag v1.4.1 and deploy; check the checkout 5xx rate is back under 1%. Then merge hotfix/1.4.1 into main, so release/1.5 keeps the fix.

                                                                                                    Vague vs precise prompt

                                                                                                    Vague prompt

                                                                                                    fix the checkout bug in production quickly

                                                                                                    Typical resultFixes the bug on main and deploys main, which also ships two weeks of unfinished features nobody tested for this release. Or it fixes the release branch only, never brings the fix to main, and the next release breaks checkout again.

                                                                                                    Precise prompt

                                                                                                    Hotfix: branch hotfix/1.4.1 from release/1.4, commit only the gift card fix with a test that fails without it, run the checkout suite and get one review, merge into release/1.4, tag v1.4.1 and deploy, then merge hotfix/1.4.1 into main.

                                                                                                    Typical resultProduction gets only the fix, checkout errors drop within minutes of the deploy, and main has the fix too, so release/1.5 keeps it. The new test guards the fix, since a hotfix skips part of the usual release testing.

                                                                                                    Seen on

                                                                                                    • Atlassian Git tutorials, Gitflow workflow: Hotfix branches are used to quickly patch production releases. In Gitflow they start from main (the production line there) and, when done, are merged into both main and develop, the line the next release comes from.
                                                                                                    • Pro Git book, Basic Branching and Merging: Its example makes a hotfix branch for an urgent production bug, commits the fix, merges it and deploys it, while unfinished work on another branch stays out until it is merged in later.
                                                                                                    • Google SRE book, Release Engineering: Describes the other common order: bug fixes go to the mainline first and are then cherry-picked into the release branch, so the team knows exactly what each release contains.

                                                                                                    You might describe it as

                                                                                                    • patch what's live without waiting for the next release
                                                                                                    • branch from the release that's in production
                                                                                                    • ship an urgent fix and merge it back into main

                                                                                                    Not to be confused with

                                                                                                    • Revert

                                                                                                      A hotfix is the urgent path that ships one fix to the release that is live, and that fix is often itself a revert of the bad commit made on the release branch; a revert is the git command that undoes one commit by adding its exact opposite, on any branch.

                                                                                                    Release branch

                                                                                                    Cut release/1.4 and watch new work keep landing on main but not on the release. Then ship it: the v1.4.0 tag from release/1.4 goes to production.

                                                                                                    Chips are commits, newest on the right.

                                                                                                    Commits on main: 3 · on release/1.4: 0 · Production: v1.3.2

                                                                                                    main has A, B and C, and features D and E are ready to merge. Production runs v1.3.2.

                                                                                                      Not cut yet

                                                                                                      A branch cut from main for one release, such as release/1.4: it only takes fixes, the release is tagged and deployed from it, and new features keep landing on main for the next release. Trunk-based teams make each fix on main and cherry-pick it over; Gitflow teams fix on the release branch and merge it back. It has a cost: every fix must reach both branches, and a release branch kept for a long time drifts away from main, so teams keep it short and delete it after the next release ships.

                                                                                                      Say it in a prompt

                                                                                                      Cut release/1.4 from main a few days before the release with git switch -c release/1.4 and push it, and keep merging new features to main as usual. Allow only bug fixes on release/1.4: make each fix on main first, copy it over with git cherry-pick -x, and run CI on release/1.4 too. Tag v1.4.0 from release/1.4 and deploy that tag to production, then delete the branch once 1.5 has shipped.

                                                                                                      Vague vs precise prompt

                                                                                                      Vague prompt

                                                                                                      make a branch for the release

                                                                                                      Typical resultCreates a release branch that lives for months and keeps taking new features, with main merged into it now and then. The two branches drift, every merge brings conflicts, and nobody is sure what production runs.

                                                                                                      Precise prompt

                                                                                                      Cut release/1.4 from main at the commit we want to ship and allow only bug fixes on it: make each fix on main first, then copy it with git cherry-pick -x. Tag v1.4.0 from release/1.4 and deploy that tag, keep merging features to main, and delete the branch after 1.5 ships.

                                                                                                      Typical resultProduction runs exactly what was cut, plus the fixes picked onto it, and work on main never waits for the release. Every fix still has to land on both branches, and the branch lives only until the next release, so it doesn't drift far from main.

                                                                                                      Seen on

                                                                                                      • Martin Fowler, Patterns for Managing Source Code Branches: The Release Branch pattern: a branch that only accepts commits that stabilize one version for release, while the main team keeps adding features to the mainline. It warns that branches drift apart and fixes must be copied back, or a regression follows.
                                                                                                      • trunkbaseddevelopment.com, Branch for release: Release branches are cut just in time, a few days before a release, and developers don't commit to them. A bug is fixed on trunk first and cherry-picked to the release branch, and the branch is deleted some time after the release.
                                                                                                      • Atlassian Git tutorials, Gitflow workflow: Once enough features are in, you fork a release branch; from then on no new features go in, only bug fixes and other release tasks. When it is ready it is merged into main and tagged, and merged back into develop; the page itself calls Gitflow a legacy workflow.

                                                                                                      You might describe it as

                                                                                                      • lock what goes out in 1.4 while main keeps moving
                                                                                                      • a branch that only takes fixes for one release
                                                                                                      • keep shipping 1.4 while 1.5 work goes on main

                                                                                                      Not to be confused with

                                                                                                      • Cherry-pick

                                                                                                        A release branch is a separate line of commits for one release that only takes fixes; cherry-pick is the git command that copies one commit, often a fix made on main, onto it.

                                                                                                      Revert

                                                                                                      Also called: back out.

                                                                                                      Revert B adds a new commit that undoes B and keeps the history. Undo by rewriting history drops B and force-pushes main, while Ana has work built on the old history.

                                                                                                      Chips are commits, newest on the right. B broke checkout · Meter tick: the 1% error limit

                                                                                                      Commits on main: 3 · Errors: 9% · Rejected pushes: 0

                                                                                                      Commit B on main broke checkout, and 9% of requests fail. Ana has a commit D built on top of C.

                                                                                                        B is live

                                                                                                        Undoing a commit by adding a new commit that is its exact opposite, so the bad change goes away and the history keeps both commits. Everyone who already pulled the branch can keep working, which is why shared branches are fixed with git revert, not by deleting the commit and force-pushing. A revert only changes code: data the bad version already wrote stays wrong until you fix it.

                                                                                                        Say it in a prompt

                                                                                                        Commit b4d1e02 ("Add discounts") on main broke checkout. If the pipeline can redeploy the previous build, do that first: it is faster than any new commit. Then run git revert b4d1e02, push the revert commit to main (through a pull request if your team requires one) and let CI deploy it; check the checkout error rate is back under 1%. Don't reset or force-push main. If b4d1e02 is a merge commit, use git revert -m 1 b4d1e02. To bring the change back once it is fixed, revert the revert. Fix the orders the bad version saved with wrong totals: the revert doesn't touch data.

                                                                                                        Vague vs precise prompt

                                                                                                        Vague prompt

                                                                                                        undo the commit that broke checkout

                                                                                                        Typical resultRewrites main without that commit and force-pushes. Production recovers, but every teammate who pulled main now has history that doesn't match, their pushes are rejected, and a plain git pull merges the bad commit back in.

                                                                                                        Precise prompt

                                                                                                        Run git revert b4d1e02 on main, push the revert commit to main (through a pull request if your team requires one) and let CI deploy it; don't force-push main. Check the checkout error rate is back under 1%, then fix the orders the bad version saved.

                                                                                                        Typical resultmain gets one new commit that undoes b4d1e02, history keeps both, teammates just pull, and errors drop after the deploy. The orders saved with wrong totals are fixed on their own, since a revert only changes code.

                                                                                                        Seen on

                                                                                                        • Git docs, git revert: git revert records new commits that reverse the effect of earlier ones. Reverting a merge needs -m to name the mainline parent, and it declares you never want that merge's changes, so a later merge of the same branch won't bring them back by itself.
                                                                                                        • GitHub Docs, Reverting a pull request: Reverting a merged pull request creates a new pull request that reverts the original merge commit; merging it finishes the revert.
                                                                                                        • Pro Git book, Rebasing: Warns not to rebase commits that exist outside your repository and that people may have based work on, and shows the mess a force-push leaves for teammates who did.
                                                                                                        • Google SRE Workbook, Incident Response: Rolling back a recent release is a generic mitigation: when an outage lines up with a release, going back to a known good version speeds recovery before the cause is fully understood.

                                                                                                        You might describe it as

                                                                                                        • undo that commit without rewriting history
                                                                                                        • add a commit that takes the bad change back out
                                                                                                        • back out the change on the shared branch so nobody's copy breaks

                                                                                                        Not to be confused with

                                                                                                        • Hotfix

                                                                                                          A revert undoes one commit by adding its exact opposite, on any branch, with no new code to write; a hotfix is the urgent path that ships a fix to the release that is live, and its one commit is often itself a revert made on the release branch.

                                                                                                        Smoke test

                                                                                                        Also called: smoke check.

                                                                                                        Deploy v2 and a smoke test checks 3 key paths in production right after: a few, not everything. Deploy a broken v2 to see a failed check roll it back. Minutes are shortened to seconds here.

                                                                                                        Live: v1 · Checks passed: 0 of 3 · Rollbacks: 0

                                                                                                        v1 is live. Deploy v2, and a smoke test checks a few key paths right after.

                                                                                                          v1 live

                                                                                                          A short set of checks that runs right after a deploy and tries the few paths that matter most, such as the health endpoint, logging in and placing an order. If one fails, the pipeline rolls back to the last good version; run it on the idle side of a blue-green deploy, before traffic moves, and the bad version never gets users at all. It checks a few key paths, not everything, so it never replaces the full test suite.

                                                                                                          Say it in a prompt

                                                                                                          After each production deploy of the shop, run a Playwright smoke test from the GitHub Actions deploy job against https://shop.example.com: GET /health returns 200, log in as the test account smoke@example.test, then place a test order with a test card and cancel it. Keep it under 2 minutes. If any check fails, run kubectl rollout undo deployment/shop to go back to the last good version, and post the failed check in the on-call channel.

                                                                                                          Vague vs precise prompt

                                                                                                          Vague prompt

                                                                                                          check the site still works after we deploy

                                                                                                          Typical resultAdds a step that loads the home page once and calls it done, so a deploy that breaks login or checkout passes. Or it writes a 40-minute end-to-end suite that places real orders with a real customer account in production.

                                                                                                          Precise prompt

                                                                                                          After each deploy, run a smoke test under 2 minutes: GET /health, log in as the test account, place a test order and cancel it. On any failure, roll back to the last good version and alert on-call.

                                                                                                          Typical resultA broken checkout is caught within minutes of the deploy and rolled back by itself. The test uses its own account and cancels its order, so no real stock or money moves, and the full test suite still runs before the merge.

                                                                                                          Seen on

                                                                                                          • Microsoft Engineering Playbook: Smoke tests cover only the most critical application path, a few quick calls the app should always answer correctly; they do not aim to cover everything. They are used as a gate, including after production deployments.
                                                                                                          • Azure DevOps Blog: Running smoke tests automatically after each deployment surfaces deployment failures early and confirms that the deployment, configuration and resources all work.
                                                                                                          • AWS CodeDeploy docs: A deployment can run validation tests in lifecycle hooks before traffic moves to the new version (BeforeAllowTraffic) or after it does (AfterAllowTraffic); a failed result can trigger a rollback.
                                                                                                          • AWS CodeDeploy docs: With automatic rollback turned on, a failed deployment redeploys the last known good revision, as a new deployment.

                                                                                                          You might describe it as

                                                                                                          • check the main pages still work right after a deploy
                                                                                                          • a quick test run against production after each release
                                                                                                          • make sure checkout works before we call the deploy done

                                                                                                          Not to be confused with

                                                                                                          • Health check

                                                                                                            A smoke test walks a few main user paths once, right after a deploy; a health check asks each pod "are you alive and ready?" every few seconds, all the time.