skip to content

learn.smmeyer.devsystem-design08

system-design/08

production · core · ~3h practice

Observability & operations

outcome

Design a system that can be understood, debugged, rolled out, and operated under pressure.

Plan a practice session · ~3h including exercises
Read + trace the worked example
25 min
Assignment + constraint variations
100 min
Timed drill + repeated explanations
35 min
Closed-book recall + self-review
20 min

This is a suggested practice budget, including drawing, variations, and repeated drills. Reading is the first block. Split the work across sessions and use the rubric to judge when to move on.

why this matters

A design is incomplete if no one can tell whether it works. Observability should reconstruct a user request, expose saturation, and guide action—not produce maximum telemetry.

coverage

  • Metrics: RED, USE, SLIs, SLOs, percentiles, cardinality.
  • Logs: structured events, correlation IDs, privacy and retention.
  • Tracing: causal paths, sampling, spans across queues.
  • Alerting: symptoms over causes, burn rate, actionable pages.
  • Operations: capacity, incidents, postmortems, distributed debugging.
  • Delivery: canary, blue-green, feature flags, progressive rollout.

mental model

Telemetry becomes useful when it connects user symptom to saturated resource or failing change.

  1. 1 →Observe

    Metric + trace

  2. 2 →Localize

    Service + tenant

  3. 3 →Mitigate

    Flag + shed

  4. 4 →Learn

    Postmortem + fix

Read in numbered order: observe → localize → mitigate → learn.

lessons

01Measure from both directions

RED—rate, errors, duration—describes request-serving behavior. USE—utilization, saturation, errors—describes resources. Together they connect a user symptom like p99 latency to a cause like GPU queue saturation.

Start outside the system: can a user complete the critical workflow, and how long does it take? Then inspect internal signals such as queue age, database saturation, and dependency errors to explain the symptom. CPU alone does not tell you whether a feature is useful; low CPU can coexist with requests waiting on a failed dependency. Link each dashboard panel to a diagnostic question.

Use rates and distributions carefully. An average of 100 ms may combine many fast requests with a small set taking ten seconds. Track latency percentiles and errors by meaningful bounded dimensions, such as region and operation. Unbounded labels like request_id or arbitrary tenant_id create too many time series. Put per-request detail in logs or traces and use controlled cohorts or targeted analysis for tenant diagnosis.

Alerts should demand an action. “Checkout success is below target and the budget is burning rapidly” gives an operator an urgent symptom. “CPU exceeded 70%” may be useful context but can page during healthy batch work. Define the initial investigation and owner with the alert; otherwise the notification merely transfers an unexplained chart to a tired person.

  • Prefer histogram percentiles over averages
  • Control high-cardinality labels
  • Define SLI exactly at the user boundary

02Reconstruct one request

Propagate a correlation or trace ID through services and asynchronous work. Structured logs make fields queryable; traces preserve causality. Sample intelligently and never log secrets or raw sensitive prompts by default.

A trace connects spans for one request: edge, API, database, queue publish, and later worker processing. Propagate trace context across asynchronous messages rather than stopping at the broker. Attach stable operation and deployment identities so a retry can be distinguished from a new business action. Record enough timing to separate time waiting for a worker from time spent executing.

Logs capture discrete facts: an authorization denial, state transition, or provider error. Metrics summarize populations; traces show selected paths. They answer different questions and should cross-reference each other. Avoid logging secrets or unrestricted document bodies merely to simplify debugging. A redacted error category, source/version ID, and access-controlled diagnostic record may provide the needed evidence.

Sampling creates blind spots. If you sample one percent uniformly, a rare failure may not appear in the retained traces. Consider retaining errors, unusually slow requests, or temporarily targeted traffic, while bounding cost. Absence from sampled traces does not prove an event did not happen. Preserve durable business records for effects that must be audited regardless of observability sampling.

  • Carry context in message headers
  • Record retry attempt and idempotency key
  • Link model, prompt, tool, cost, and outcome

03Rollouts are experiments with brakes

Canaries expose a small traffic slice, feature flags separate release from deployment, and blue-green gives fast environment rollback. Define health gates and automatic halt conditions before rollout.

A canary is an experiment with limited exposure: send a small eligible population to a new version and compare task success, latency, and resource use. Define the stop rule before rollout. A canary without a meaningful metric or rollback owner only limits the initial blast radius; it does not establish that the change is safe.

Rollback can reverse code without reversing data. If a release writes a new schema that old code cannot read, deploying the old binary can worsen the incident. Use an expand-and-contract migration: add compatible structures, deploy readers and writers gradually, migrate data, then remove the old form after rollback is no longer needed. Test mixed-version behavior.

During an incident, separate mitigation from explanation. First reduce customer harm with a reversible action—shed traffic, disable an optional feature, or stop a rollout. Preserve a timeline and evidence for later diagnosis. A useful incident report connects trigger, propagation, detection, mitigation, and a concrete prevention change; “be more careful” does not repair a system mechanism.

  • Alert on user symptoms and SLO burn
  • Postmortems improve systems, not blame people
  • Capacity plans need lead time for scarce resources

worked example

The average is healthy while one tenant is failing

Overall API success is 99.95%, but a large tenant reports timeouts after a deploy.

  1. Start from the user's operation: successful responses within its deadline. Segment by region, route, deployment version, and a controlled tenant cohort.
  2. Use traces to locate queue wait before the database call. The database's own average latency can remain normal while callers time out waiting for a connection.
  3. Compare saturation and tail latency with the previous release. Keep request IDs in logs for investigation rather than adding an unbounded ID label to every metric.
  4. Roll back or cap the offending workload, then confirm recovery through the same tenant-facing success signal.

Design decision: Alert on user-visible failure and use bounded dimensions plus traces to explain it.

Limit: Sampling can hide rare incidents. Retention, privacy, and diagnostic coverage must be chosen deliberately.

Teaching scenario · traffic, prices, and capacity values are illustrative.

assignment

Produce: A dashboard sketch, two actionable alerts, and a short incident report.

Paper, a text editor, or a spreadsheet is enough. Model access and paid services are optional.

  1. Specify latency, traffic, errors, saturation, and a business success metric with units and useful slices.
  2. Trace a slow request across queue, service, and dependency; identify what each signal can establish.
  3. Write the first five incident actions and a postmortem with one prevention change and one detection change.

Change a constraint

  • Tracing is sampled at 1% and the failure affects 0.01% of requests.
  • A proposed dashboard adds user_id and request_id as metric labels.

Self-review rubric

  • Alerts identify user impact and an owner action.
  • Metrics avoid uncontrolled cardinality.
  • The diagnosis distinguishes queue time from service time.

If a criterion is missing, revise that part of the artifact before rating your practice below.

Compare a sample artifact after your attempt

One defensible answer under these assumptions. Compare the reasoning and checks with your work; other designs can satisfy the same contract.

After a deployment, one large tenant has timeouts while overall success remains 99.95%. The following numbers and incident timeline are fictional.

Dashboard: checkout/download success + p95/p99 by region/operation
           dependency spans + queue age + current deployment version
Alert 1: sustained rapid SLO budget burn → rollback/on-call owner
Alert 2: oldest high-priority job exceeds its wait budget → inspect workers
Incident: 10:00 canary deploy; 10:04 tenant report; 10:07 trace shows
new query scan; 10:10 stop rollout; 10:15 rollback; 10:20 validate recovery
Follow-up: representative large-tenant query case + rollout stop rule

Use bounded cohort labels for metrics and access-controlled logs/traces for targeted tenant detail. Correlate request, operation, trace, and deployment IDs without turning each into a metric label. At 1% tracing, a very rare failure may be absent; retain errors or target diagnostics under a cost budget rather than treating no trace as proof of no failure.

Check your artifact

  • Each page has an action and owner, not just a resource threshold.
  • The report separates mitigation from the later root-cause investigation.
  • Rollback compatibility includes data written by the new release, not just the previous binary.

A tempting mistake: A healthy average can hide an entire failing slice. Investigate the affected cohort and critical path before dismissing the complaint.

cumulative practice

Relay · build and evolve a private file service

Project brief

Keep one design document for Relay, a tenant-aware file service. Start with 100k daily users, ten downloads per user/day, 10k uploads/day, 1 MB typical bodies, 30-day retention, and a 5× download peak. Files are private to workspaces. Treat these as fictional planning assumptions. Later chapters add previews, recovery, regional constraints, compute, and an assistant. Record each change rather than replacing the earlier version; the final review combines the whole packet. These activities share the chapter's existing practice budget.

Keep one project document across this track. Reconstruct earlier reasoning before opening notes, then revise the same artifact. Use part of the assignment and review budget for this work. If you enter mid-course, sketch the earlier decisions first using the linked chapters.

Add to your project: Relay's trace and rollout evidence sheet.

Recall the download SLO and asynchronous preview path. Add span boundaries and operation identities across the queue. A new preview release doubles oldest-job age while download success stays healthy: which alert, rollout action, and isolation check are appropriate?

Compare cumulative reasoning after your attempt

Carry trace and job identity into preview work, and separate queue wait from execution. Stop or roll back the preview rollout when its declared age budget is violated; inspect worker completion rate, retries, and version. Do not page as a download outage solely from preview age, but check that shared resource contention cannot spread there. Preserve versions and timing so the next release can include a representative regression case.

Keep your first attempt and revision together. If your answer differs, identify the assumption or mechanism that explains the difference before rating your recall.

senior signal

For AI systems, correlate request ID, model/prompt version, retrieved documents, tool calls, token usage, latency stages, safety result, and user outcome—with privacy controls.

failure patterns

  • Alerting on every CPU spike instead of user impact
  • Averages that hide tail latency
  • Unbounded tenant IDs as metric labels
  • Canarying without predefined stop conditions

knowledge checks

Start with these quick checks, then explain the closed-book questions in your own words.

  1. 01Which is a symptom alert?

    select an option to check your answer

  2. 02Why avoid tenant_id as an unbounded metric label?

    select an option to check your answer

closed-book recall

Close the worked example and explain these from memory. Answers are self-reviewed. Drafts stay on this page; save anything you want to keep in chapter notes.

Rate the assignment and recall together

Use the assignment rubric as evidence. Completion is your own judgment; this score schedules practice.

interview drill

Create the observability plan for a coding agent that runs up to 45 minutes and may call 200 tools.

  • long-running
  • privacy
  • 200 calls
  • multiple retries
compare a strong approach after your attempt

Give each run a trace with spans for planning, model calls, tools, tests, and checkpoints. Track success, wall time, queue time, tokens, tool errors, loop signals, and human interventions. Sample detailed artifacts behind access controls; keep aggregate metrics broad. Alert on stuck-run age and fleet-level success/burn, not one flaky tool call.

Compare decisions and failure behavior, then repeat with a changed constraint. Keep your own wording.

Use the timed mock workspace →

references

Sources offer deeper context. Provider capabilities and API contracts can change; check current official docs before implementing.

notes

saved locally