System Architecture — 2027.1
Most systems you will build or maintain in your career have to be fast, available, consistent enough, secure and affordable — at the same time, under load, while parts of them fail. This edition of the course is about how to design such systems, how to prove with numbers that a design works, and how to explain it — to a team in a design review, and to an interviewer in a system-design interview.
What changes in 2027.1
The course is reorganized around the building blocks of modern architectures — the same palette of components you will find in the System Design Playground: client, traffic & edge, compute, storage, messaging, observability, network, AI & agents and external services.
- Every class teaches a group of components, with the trade-offs, the numbers and the failure modes that matter in practice and in interviews.
- Every class page embeds the playground, preloaded with a scenario, so you can see the concept under load: change a parameter, run a load test with randomness (crashes, spikes, hot keys, region outages), read the report.
- The hands-on labs build one system along the semester — BoxOffice, a ticketing platform with a flash sale at 10:00 — and every lab ends with a "Measure it" step.
- The Support section has the interview material, a workbook, a cheat sheet, a concept map and study cards.
The running example: BoxOffice
A stadium show goes on sale at 10:00. Two million fans, sixty thousand seats. The catalog is read-heavy, the seat inventory must never sell the same seat twice, payments go through an external provider that sometimes slows down, confirmations go out by e-mail, bots try to buy everything, and an AI assistant answers "find me two seats under R$ 300 for Saturday and hold them". Almost every topic of the course appears in this one system.
flowchart LR
U["fans<br/>(web, mobile)"] --> DNS["DNS"] --> CDN["CDN"] --> WAF["WAF"] --> GW["API gateway"]
GW --> AUTH["auth"]
GW --> CAT["catalog"] --> CACHE[("cache")]
CACHE --> SQL[("SQL")]
GW --> Q["waiting room<br/>(queue)"] --> INV["inventory<br/>(seat holds)"] --> SQL
INV --> ORD["order"] --> PAY["payment"] --> EXT["payment provider"]
ORD --> K["event stream"] --> NOTIF["notification"] --> MAIL["e-mail"]
K --> AN["analytics / DWH"]
GW --> AI["assistant<br/>(LLM gateway, tools, RAG)"] The story of the course
The classes are not a list of topics: they are the chapters of one story. BoxOffice starts as one service and one database, and every chapter begins with the problem the previous one left, stated with a number. A component enters the design only when a number asks for it, and each one brings a new problem. Press play to follow the chain:
flowchart TD
C1["1. What must BoxOffice do, and how well?"] -->|"2 M fans, 60 k seats, p99 < 300 ms:<br/>is one database enough?"| C2["2. Estimate before you build"]
C2 -->|"33,000 holds/s against ~1,100:<br/>we need more than one machine"| C3["3. More machines, a network that lies"]
C3 -->|"replicas exist: who receives<br/>the 2 M requests at 10:00?"| C4["4. Traffic, edge & identity"]
C4 -->|"the edge spreads load over replicas:<br/>what must a replica be?"| C5["5. Compute & services"]
C5 -->|"stateless services push all<br/>state into the database"| C6["6. Databases"]
C6 -->|"the event pages are read 100× more<br/>than they change"| C7["7. Caching"]
C7 -->|"checkout still waits<br/>for the e-mail provider"| C8["8. Messaging"]
C8 -->|"asynchrony hides failures:<br/>where did that order go?"| C9["9. Observability"]
C9 -->|"now we see it: the provider answers<br/>in 4 s and drags checkout down"| C10["10. Reliability"]
C10 -->|"a laptop with Compose cannot heal,<br/>scale or deploy safely"| C11["11. Cloud-native platforms"]
C11 -->|"many services on one platform:<br/>who may talk to whom? what do we ship?"| C12["12. Network & security"]
C12 -->|"fans ask in plain language:<br/>'two seats under R$ 300, Saturday'"| C13["13. AI systems"]
C13 -->|"more changes, faster:<br/>who reviews, tests, releases?"| C14["14. AI-assisted delivery"]
C14 -->|"does the whole design hold<br/>the next on-sale? prove it"| C15["15. Performance engineering"]
C15 -->|"the same blocks, other systems"| C16["16. Case studies"] Each row of the table is one chapter: the problem that opens it, the class that answers it, the lab where you build the answer in BoxOffice (and the file to read first), and the playground scenario where you can see it fail and recover. The planning puts the chapters on the calendar.
| The problem (BoxOffice) | Class | Built in | Code to read | See it | |
|---|---|---|---|---|---|
| 1 | Nobody has written down what "works" means: how many fans, how fast, how available. | What is System Design | Lab 0 | scripts/check-env.sh | monolith, flash-sale |
| 2 | Can one PostgreSQL take the 10:00 on-sale? Demand is ~33,000 holds/s; one database does ~1,100 at a sane utilization. | Estimation | Lab 1, Lab 2 | load/stress.js, scripts/sweep.sh | monolith (breakpoint) |
| 3 | A 30× gap means many machines, and between machines the network loses, delays and duplicates messages: a retried "buy" can charge twice. | Distributed Systems | Lab 2 (the knee, measured) | — | db-replicas, multi-region |
| 4 | Two million phones press refresh at 10:00:00. Most of those requests must never reach a service, the rest must reach a healthy replica, and every caller must prove who it is. | Traffic & Edge | Lab 3, Lab 4 | infra/nginx/nginx.conf, TokenService.java | scale-out, cdn-static, rate-limiter |
| 5 | Behind the edge, replicas come and go: a replica that keeps the session or the hold in memory loses it. What must a service be to scale out? | Compute & Services | Lab 4 | SecurityConfig.java (gateway) | microservices, serverless-burst |
| 6 | Stateless services push every decision into the database, and 2 fans click the same seat in the same millisecond. | Databases | Lab 6 | HoldService.java | db-replicas, sharding, db-failover |
| 7 | The event pages are read ~100× more than they change; the database spends its capacity answering the same question. | Caching | Lab 5 | EventCache.java | read-heavy-cache |
| 8 | Checkout waits for the e-mail and the provider; when the e-mail server is down, nobody can buy. 30× more fans than capacity need a fair line. | Messaging | Lab 7 | Outbox.java, WaitingRoom.java | async-queue, event-fanout |
| 9 | Asynchrony hides failures: an order vanishes between Kafka and the e-mail, and the dashboards stay green while fans cannot pay. What exactly do we promise (the SLO), and how do we know we keep it? | Observability | Lab 8 | slo-catalog.yaml | observability-stack |
| 10 | Now we can see it: at 10:02 the payment provider answers in 4 s instead of 200 ms. Nothing is down, yet every order thread waits on it and checkout dies with it. | Reliability | Lab 9 | PaymentClient.java | cascading-failure, retry-storm, db-failover |
| 11 | Compose on one machine does not restart a dead replica on another node, scale at 09:45 or roll a bad release back. | Cloud-Native | Lab 10, Lab 11 | catalog-hpa.yaml, catalog-rollout.yaml | k8s-node-failure, serverless-burst |
| 12 | Many services now share one platform: bots buy the best seats, a token leaks, every service trusts every other one, and nobody checks what the pipeline ships. | Network & Security | Lab 11 (supply chain) | .github/dependabot.yml | payment-system, flash-sale |
| 13 | Fans ask "two seats under R$ 300 on Saturday?": the answer comes from a slow, expensive, non-deterministic dependency that reads the catalog and the seat map through tools, and must never invent a seat or obey text hidden in a page. | AI Systems | Lab 12 | agent.py, tools.py | ai-assistant |
| 14 | With AI writing code, changes arrive faster than people can review, test and release them. | AI-Assisted Delivery | Lab 13 | review.py | ai-assistant |
| 15 | Every chapter added a box. Does the whole design hold the next on-sale, and what does it cost? | Performance Engineering | Lab 11, Project | load/budget.js | flash-sale |
| 16 | A different system tomorrow (a feed, a chat, a ride app): the same blocks, other numbers. | Case Studies | Exercises | — | one per case |
How to read a class with the story in mind
Every class opens with "The story so far" (where BoxOffice is and which number forces this class) and ends with "What breaks next" (the limit of what you just learned, which opens the next chapter). Every subpage has a "How it connects" map, a "Best practices" box (the habits a reviewer expects, next to the pitfalls to avoid) and, when a lab implements the idea, an "In the BoxOffice code" box with the real file; every lab lists the best practices its code applies. When you can say, for each component, which number put it there and what it costs, you can defend the design — in a review or in an interview.
Map of the course
| Part | Classes | Labs (BoxOffice) |
|---|---|---|
| Foundations | 1. What is System Design · 2. Estimation & Performance Math · 3. Distributed Systems | 0. Environment · 1. First service · 2. Measure first |
| Building blocks | 4. Traffic & Edge · 5. Compute & Services · 6. Databases · 7. Caching · 8. Messaging | 3. Edge · 4. Gateway & identity · 5. Caching · 6. Data at scale · 7. Async |
| Operating at scale | 9. Observability · 10. Reliability · 11. Cloud-Native · 12. Network & Security | 8. Observability · 9. Resilience & chaos · 10. Kubernetes · 11. Delivery |
| AI | 13. AI Systems & Agents · 14. AI-Assisted Delivery | 12. AI assistant · 13. AI in CI/CD |
| Prove it | 15. Performance Engineering · 16. Case Studies | Exercises · Project |
The week-by-week plan is on the planning page.
Meetings
| Class | TBD | TBD |
| Class | TBD | TBD |
| Office hours | TBD | TBD |
Instructors
Grade
-
Exercises (individual): seven exercises — estimation, load-test report, cache & database, event-driven, Kubernetes autoscaling, playground design and design doc — each graded with a concept (A–I) and a rubric. Weights and rules are on the exercises page.
-
Quizzes: three quizzes; the lowest is dropped and the grade is the average of the two best:
\[ \text{Quizzes} = \frac{\text{Q}_1 + \text{Q}_2 + \text{Q}_3 - \min(\text{Q}_1, \text{Q}_2, \text{Q}_3)}{2} \] -
Exams: a midterm and a final exam, individual, covering the classes and the labs. Part of each exam is a short system-design question in the format of the interview framework.
-
Team project: teams of 2 or 3 students build, measure, break on purpose and defend one system, in nine milestones (design doc, core path, scale & cache, async & resilience, Kubernetes + CI/CD, load-test campaign, chaos game day, cost report, presentation). The team grade is the same for all members. Details on the project page.
Team registration
Deadline: end of week 3 (date on the planning page).
Teams from 2 up to 3 members, one GitHub repository per team, documentation on GitHub Pages.
ORAL EXAMINATION
ALL GRADES in this course are subject to an oral examination for validation. If the outcome of the oral examination is negative, that specific grade will be ZEROED.
Use of AI tools
AI tools are allowed and are part of the course (classes 13 and 14 and lab 13 are about building with them). You are responsible for every line and every number you deliver; measurements must come from runs you did. The rules are on the exercises page.
Repositories
Course repository (code of the labs and starters): repo-classes/pma271 (to be published).