Demos and exercises#
Work through one module at a time: change the inputs, inspect what responds, and connect the result to your own project. Repeat a scenario until you can explain the trade-off without relying on the interface. Where practice is available, switch to its tab to check your understanding. Saved results are shared with the chapter exercises.
- Modules
- 32
- Exercises
- 11
- Mode
- Self-guided
Scalable development
Implementation discovery labImplementation discovery lab
Find a direction worth building three times
The behavior is shared. Your interpretation, stack, architecture, and experiment are yours to choose.
Scalable development
Constraint feedback loopConstraint learning loop
Turn evidence into project memory
- 01Constrainstate what must remain true
- 02Generateproduce a bounded candidate
- 03Validatecompare evidence with intent
- 04Revisemake the learning explicit
Candidate + evidence
No candidate generated
- —Browser testCan clicking Export create a download?
- —Changed-files checkDid the patch stay inside export.ts and export.test.ts?
- —CSV assertionAre commas and quotation marks escaped?
Generation is not evidence. Generate a candidate, then run the checks.
Scalable development
Deterministic boundary labDeterministic boundary lab
Give the agent a map
Pause & think
Follow the release gates
In this delivery statechart, release readiness requires both passing checks and an approved review. Checks have passed, but review has not started. Select the missing gate and the destination of REQUEST_CHANGES during review.
Automatically checked practice. Saved answers are private to your account.
Checking saved answers…
Your answers to earlier versions
Show worked answer
Passing checks alone does not complete the parallel verification state. Review must also approve. REQUEST_CHANGES returns the patch to implementation.
What does scalability mean for web development?
Scalability dimensions labScalability dimensions lab
Choose what must scale first
Pause & think
Check a scaling contract
A service must handle 200 requests/s while keeping p95 below 150 ms and errors at or below 1%. A run handles 220 requests/s with p95 = 180 ms and errors = 0.5%. Check the run against this contract.
Automatically checked practice. Saved answers are private to your account.
Checking saved answers…
Your answers to earlier versions
Show worked answer
Throughput and errors pass, but latency fails. Handling more requests is insufficient when the declared quality bound is violated.
Architecture
Boundary traceArchitecture boundary trace
Trace one event request
Pause & think
Separate response from outcome
An API commits an event to storage, then the network loses its response. The browser times out. Use only these stated facts to classify the outcome.
Automatically checked practice. Saved answers are private to your account.
Checking saved answers…
Your answers to earlier versions
Show worked answer
The storage commit happened even though the browser received no confirmation. A timeout describes what the caller observed; it does not undo or disprove the commit.
Architecture
ACID transaction labDatabase invariant workbench
Keep state and history in one truth
Run the same work-item operation with application-managed writes or a database transaction. The ledger exposes which guarantee actually protects the project contract.
This is a deterministic transaction model, not a benchmark of a particular database. Real isolation and durability depend on the database, transaction boundaries, constraints, storage configuration, and failure model.
Architecture
Cache decision labHTTP reuse control room
Where does the next response come from?
Every case begins after one successful response. Change its policy and age, then trace the next request without changing the URL.
Architecture
Web architecture lensTwo architectural decisions
Compose a web request
SSR, ISR, and CSR describe where and when a view is produced. MPA, HDA, and SPA describe how the browser moves to later application states.
Architecture
Client activation lensBrowser activation cutaway
What wakes up before the click?
The server returns the same useful event page in every case. Change only how browser behavior becomes available, then trace the first attempt to record an event.
Architecture
API contract lensContract topology lab
Where does the client learn what it can do?
Hold the domain intent constant. Move between contracts to see which facts live in client code, which arrive from the server, and where change creates coordination.
Benchmarking
Tail latency simulatorTail latency simulator
An average can hide slow requests
POST /events
requests. It does not contact a server.
Pause & think
Calculate the average and the tail
A fixed sample contains 20 requests: 18 take 40 ms each and two take 240 ms each. Use the nearest-rank percentile: sort the values, then take rank ceil(0.95 × 20). The objective requires latency strictly below 120 ms. Calculate the mean and p95, then choose which meet the objective. This sample is separate from the adjustable simulation in Explore.
Automatically checked practice. Saved answers are private to your account.
Checking saved answers…
Your answers to earlier versions
Show worked answer
The total is 18 × 40 + 2 × 240 = 1200 ms, so the mean is 60 ms. Rank 19 is 240 ms. The average meets the objective while p95 does not; an average can conceal a slow minority.
Benchmarking
Goodhart pressure testGoodhart pressure test
Can your metric survive an optimizer?
- 01 Target
- 02 Pressure
- 03 Repair
Benchmarking
Browser performance workbenchBrowser performance workbench
Repeat one interaction before trusting it
02 / Inspect the runs
Time until the next painted frame
Run the same interaction five times to reveal its distribution.
- Median total
- —
- Fastest
- —
- Slowest
- —
- Median longest slice
- —
One run is an observation. Repeated runs show whether that observation was typical.
Benchmarking
Queue balance labLittle’s Law · L = λW
Check whether the queue tells one story
- Expected L
- 10.0
- Observed L
- 10
- Gap
- 0.0
The three averages are mutually consistent for a stable observation window.
Pause & think
Check whether the averages agree
At one declared boundary you observe L = 25 operations, λ = 40 operations/s, and W = 0.25 s. Calculate λW, then select the conclusion supported by these three values alone.
Automatically checked practice. Saved answers are private to your account.
Checking saved answers…
Your answers to earlier versions
Show worked answer
λW is 10, not 25. Check compatible boundaries, observation windows, units, omitted waiting, and whether arrivals and completions balance. The discrepancy alone does not locate a bottleneck or show that adding workers will help.
Appendix A: Agent workflow evaluation
Model evaluation labChallenge eval lab
Compare two model attempts on the same task
Benchmarking
Observability signal pickerObservability signal picker
Choose evidence for one symptom
Benchmarking
OpenTelemetry trace explorerOpenTelemetry trace explorer
Follow one request, span by span
The rows below are spans from one trace. Select a row to inspect the record the SDK could include in a batched OTLP export.
Trace
POST /events · 286 ms
4bf92f3577b34da6a3ce929d0e0e4736
Select any span row to inspect its telemetry record.
Friction
Workflow loopWorkflow loop lab
Trace a human-agent change loop
Pause & think
Calculate the whole change cycle
A change passes through four sequential stages with no overlap: clarification 10 minutes, editing 10, checks 15, and review 25. A tool halves editing time; every other stage stays unchanged. Calculate the new total and the time saved.
Automatically checked practice. Saved answers are private to your account.
Checking saved answers…
Your answers to earlier versions
Show worked answer
The original cycle takes 60 minutes. Editing falls from 10 to 5 minutes, so the new cycle takes 55 minutes and saves 5 minutes. A local speedup affects only its share of the full cycle.
Friction
Friction auditFriction audit lab
Find the slow part of a small change
Reality
Changed assumptions mapIncident response challenge
Keep the event pipeline useful
-
01
DetectFind the first limit
-
02
ContainBreak the retry loop
-
03
RecoverProtect shared capacity
-
04
DebriefDefend the trade-off
Pause & think
Count the effects of a retry
An event request commits once, but its response is lost. The client retries on another instance. There is no deduplication, and that retry also commits once. Count the stored effects, then select the mechanism that prevents this duplicate effect when the same operation is retried.
Automatically checked practice. Saved answers are private to your account.
Checking saved answers…
Your answers to earlier versions
Show worked answer
There are two stored effects. Reusing a stable operation key works when authoritative storage atomically records the mutation and reusable result under that key. A per-instance cache cannot coordinate retries routed elsewhere.
Appendix D: Agent-system security
Fleet trace debuggerCompare forensic lab
Reconcile what the fleet actually used
Agent fleets
Agent fleet delegationCompare delegation lab
Plan a small agent fleet
Appendix E: Scalability models
Reliability chain labLusser’s Law · Rworkflow = ∏ri
Track the error that survives every safeguard
- Step gate
- 99.500%
- Correct completion
- 60.6%
- Safe stop
- 0.0%
- Wrong result
- 39.4%
At 99.500% per step, 100 independent critical steps complete correctly 60.6% of the time.
Agent fleets
Sequential work boundAmdahl’s Law · S(N) = 1 / ((1 − p) + p/N)
Find the work that more agents cannot remove
- Ideal speedup
- 2.50×
- Relative time
- 40.0%
- Efficiency
- 62.5%
- Infinite-agent ceiling
- 5.00×
Four agents divide the parallel work, but the sequential 20% remains.
Pause & think
Calculate the parallel speedup
Assume 80% of a fixed task can run in parallel, 20% is sequential, and coordination has no cost. Use S(N) = 1 / (0.2 + 0.8 / N). Calculate the speedup with four workers and the limit as the worker count grows without bound.
Automatically checked practice. Saved answers are private to your account.
Checking saved answers…
Your answers to earlier versions
Show worked answer
Four workers give 1 / 0.4 = 2.5 times the original speed. Even infinitely many workers leave the sequential 20%, so the limit is 1 / 0.2 = 5. Coordination costs would reduce these ideal results.
Scaling
Scaling pressure plannerCompare scaling lab
Choose scaling moves for one pressure
Scaling
Saturation boundary labCapacity envelope
Find the first binding limit
This is a teaching model, not a capacity benchmark. It compares one effective demand rate with declared stage limits so the movement of a bottleneck is visible.
Pause & think
Locate the next capacity limit
Each request visits every stage once. Capacities are API 180, database 110, workers 150, and downstream 130 requests/s. Offered load is 150 requests/s, with no retries. Use the smallest stage capacity as the throughput ceiling. Then raise database capacity to 150 requests/s, leaving all other capacities unchanged.
Automatically checked practice. Saved answers are private to your account.
Checking saved answers…
Your answers to earlier versions
Show worked answer
Initially the database limits throughput to 110 requests/s. Increasing its capacity moves the limit to the downstream stage at 130 requests/s. Offered load still exceeds capacity by 20 requests/s.
Appendix E: Scalability models
Contention curve labUniversal Scalability Law · C(N)
See when adding concurrency starts taking capacity away
- Selected capacity
- 5.57×
- Peak at
- 22
- Peak capacity
- 7.33×
- Next worker
- helps
At eight workers, added concurrency still increases modeled capacity.
Scaling
Orchestration control loopBrowser cluster lab · Webernetes
Watch the control loop close
Debrief the mechanism and its limits
Name the desired state, the observed state, and the controller action after each experiment. Then identify what remains outside this model.
- Replicas add service instances; they do not remove database limits.
- Replacement demonstrates recovery, not uninterrupted availability.
- This simulator omits real images, resource limits, persistent volumes, and production networking.
Appendix F: Durable workflows
Durable effect retry labScaling failure lab
Crash between effect and checkpoint
Scaling
CAP partition labDistributed data fault table
Decide what happens across a partition
Helsinki becomes isolated from the Frankfurt–Dublin majority. Alice and Bob then try to start the same work item from opposite sides of the split.
The model holds workload, topology, and failure constant so the policy is visible. Real systems define quorums, timeouts, leases, conflict resolution, and consistency guarantees more precisely.
Scaling
Latency budget mapLatency budget lab
Count distance and database waits
Recap
Final reflection packageFinal reflection package
Build a reflection from course artifacts
More practice
Pause & think
Choose a valid comparison
You want to test whether batching improves useful write throughput while keeping p95 end-to-end latency below 100 ms and errors at or below 0.1%. Select the comparison that isolates batching. Then evaluate a run with higher throughput, p95 = 90 ms, and errors = 0.8% against those declared criteria.
Automatically checked practice. Saved answers are private to your account.
Checking saved answers…
Your answers to earlier versions
Show worked answer
Keep the workload, dataset, environment, and acceptance criteria comparable while changing batching. A run with p95 = 90 ms passes the latency bound, but 0.8% errors violates the 0.1% error bound. Higher throughput does not compensate for failing a declared acceptance criterion.
Pause & think
Classify evidence and next steps
Use observation for a reported measurement, inference for an explanation drawn from evidence, and proposal for an action to try. Classify each statement by its role; you are not being asked whether the explanation is true.
Automatically checked practice. Saved answers are private to your account.
Checking saved answers…
Your answers to earlier versions
Show worked answer
Measurements describe what was recorded. A causal explanation goes beyond that observation. A proposed experiment states what to do next and can test the explanation.