Slide 2 of 4

Apply the pattern to your own service

Scenario

Your team ships a read-heavy API or a page that fans out to several HTTP calls. In reviews, someone asks: “Are we sure this stays fast enough when traffic is normal Monday morning, not just on a developer laptop?” You want the same observe, set, validate loop you used on QuickPizza, but the URL, auth, and risk profile are yours.

Tradeoffs to decide explicitly

ChoiceUpsideCost or risk
Staging vs production-likeSafer for destructive mistakesMay miss real data shape, caches, or latency; document what is missing
Synthetic auth in setup()Repeatable runs in CITokens expire; secrets belong in secret stores, not the repo
Low VU count firstFast feedback, easier debuggingCan miss concurrency bugs; raise VUs only after the script is stable
Tight vs loose p95 thresholdTight catches small regressionsToo tight flakes on noise; loose misses real problems. Start from measured p95 plus headroom

What “good” looks like

  • One primary route in scope first (expand later). Everyone agrees which URL or user journey the gate protects.
  • Steady-state window long enough that p95 and error rate stop jumping run to run.
  • Checks assert something the business cares about (status, a required field), not only “200 OK.”
  • Thresholds came from numbers you observed, not a round number someone guessed.
  • Flaky gate = worse than no gate; if CI fails randomly, fix the profile or thresholds before enforcing.

Transfer exercise (15 to 30 minutes)

Do this once on a non-production URL your team owns:

  1. Pick the target: one critical GET or POST and a success condition you can assert in a check.
  2. Copy the QuickPizza script shape: options, default function, at least one http call and a sleep that matches realistic pacing.
  3. Run once without thresholds at a modest VU count; note p95, http_req_failed, and throughput from the summary (or Grafana Cloud k6).
  4. Set thresholds with headroom on p95 and a cap on error rate; re-run until two consecutive runs agree.
  5. Write one line in your README or ticket: what the gate protects and what you would do if it fails.

That is enough to prove the skill transferred. When you expand, use your internal standards and the documentation on the Where to go next slide.

Script

QuickPizza taught the pattern. This slide is the transfer step: a short scenario, the tradeoffs teams argue about, what “good” looks like on your own service, and a checklist you can run without rereading the whole course.

You do not need production traffic on day one. You do need a clear target, honest load, and thresholds tied to what you measured.