Whiteboarding a Production System You Owned
Hard · System Design · Software Engineer · Onsite
Prompt
Select a real production system that you personally built, architected, or operated, and sketch its end-to-end architecture as if presenting at a whiteboard.
Walk through its major building blocks, read and write paths, persistence layers, horizontal scaling and fault-recovery mechanisms, CI/CD and runtime topology, and defining engineering compromises. Explain why each core technology won over plausible alternatives, and describe how the design matured across versions as load or product demands shifted.
Scope & Expectations
- Clear boundaries & concrete scale: Establish business context, latency/availability targets, back-of-the-envelope traffic and storage numbers, and a clear line between components you personally owned versus adjacent team boundaries.
- Layered architecture & data flow: Present clean synchronous and asynchronous paths, storage schemas, and failure handoffs (such as idempotency, retries, outboxes, or dead-letter queues).
- Defensible technology choices: Justify databases, queues, compute models, and caching layers with quantitative reasoning rather than buzzwords, noting operational costs accepted.
- Iterative evolution & lessons learned: Show how earlier iterations hit real bottlenecks or incidents and how targeted architectural changes resolved them.
Step-by-step walkthrough
Understand what the interviewer is really testing and pick the right system
When an interviewer asks you to whiteboard a real system you built or owned, they have no way to inspect your former employer's private source code. Instead, they evaluate five signals through how you explain and defend the design:
- True ownership and depth: Can you zoom smoothly from a 5-box overview all the way down to a database lock, retry policy, or memory limit in the component you built?
- Quantitative engineering judgment: Do you know the real traffic, data sizes, and latencies—and why those numbers ruled out simpler or fancier alternatives?
- System evolution: Can you explain how
v1broke as traffic grew tov2andv3, rather than pretending the final architecture appeared fully formed on day one? - Clear communication: Layered diagrams, numbered arrows, consistent naming, and checking in with the interviewer before diving 15 minutes into one box.
- Intellectual honesty: Clearly separating
"I designed/implemented..."from"a sibling team owned...", and reasoning out loud from fundamentals when you don't remember an exact constant.
How to choose your system before interview day:
- Pick a production system where you know the end-to-end data flow and personally built or operated at least one non-trivial component.
- Make sure it had real engineering tension—latency targets, bursty load, strict correctness, untrusted inputs, or tight cost budgets—plus at least one memorable outage or redesign.
- Scrub confidential details: generalize internal codenames (
"Upload API","Worker Pool"), round numbers ("~3 million files/day"), and omit customer names or unreleased business metrics.
To show concrete numbers, schemas, and deep dives rather than abstract advice, the rest of this guide walks through a complete worked example: a cloud document preview and text-extraction pipeline that turns uploaded images, PDFs, and Office files into fast web previews and searchable text. Swap in your own system's components and numbers using the exact same structure.
Open with a 2-minute framing: scope, your exact role, SLAs, and numbers
Spend the first two minutes giving business context, drawing a clean boundary around your personal contribution, and putting numbers on the board so every later decision can be judged objectively.
Sample first-person opening:
"I'll walk through our document preview and text-extraction pipeline. Users upload around 3 million files a day; within a few seconds they expect a thumbnail in their folder view, crisp page-by-page previews when they click a file, and extracted full text in search. I was one of four backend engineers on this team for two years, and I personally designed and owned the asynchronous worker platform—the lane queues, process sandboxing, and queue-age autoscaling. Sibling teams owned the core Upload API and the Elasticsearch cluster, so I'll treat those at their API boundaries."
Requirements
- Functional: Generate a thumbnail and page previews (first 10 pages) for images, PDFs, and Office files (
.docx,.pptx,.xlsx), plus extracted plain text for PDFs and Office files; re-run safely when a new file version is uploaded; show a clean"processing"or"preview unavailable"state in the UI. - Non-functional:
- SLO (Service Level Objective — a measurable latency/reliability promise to users):
95%of interactive uploads under20 MBhave a ready preview within 10 seconds. - Decoupled availability: File uploads must never fail or slow down even if the preview pipeline is completely down.
- No silent drops: Every uploaded version eventually reaches
readyorunavailable—never stuck inpendingforever. - Security isolation: Malformed or malicious user files must never read another tenant's data or crash shared servers.
- SLO (Service Level Objective — a measurable latency/reliability promise to users):
Back-of-the-envelope numbers (using Little's Law,
average busy workers = arrival rate * average processing time, to size compute):Upload rate 3,000,000 files/day -> ~35 files/s avg, ~120 files/s weekday peak (~3.5x) File mix & CPU cost 55% images (~0.3 s), 30% PDFs (~2.0 s), 15% Office (~8.0 s via headless suite) Weighted mean CPU 0.55 * 0.3 + 0.30 * 2.0 + 0.15 * 8.0 = ~2.0 CPU-seconds per file Total busy cores Avg: 35 * 2.0 = ~70 cores; Peak: 120 * 2.0 = ~240 busy cores Provisioned cores At 70% target utilization (30% burst headroom): 240 / 0.70 = ~340 cores Office lane at peak 120 * 15% = 18 files/s * 8.0 s = ~144 busy cores (~205 provisioned cores) Blob storage growth ~0.5 MB renditions/file * 3M/day = ~1.5 TB/day written to object storage Search text growth ~20 KB text/file avg * 3M/day = ~60 GB/day shipped to search indexer Metadata SQL writes ~10 row ops/file * 35/s = ~350 writes/s avg, ~1,200 writes/s peak (1 Postgres primary) Job wall-clock time p50 ~0.5 s (images), p99 ~45 s (dense slide decks), hard kill limit 120 s- Functional: Generate a thumbnail and page previews (first 10 pages) for images, PDFs, and Office files (
Draw the architecture in two layers: sync path vs. async path
Start with a clean 6-box whiteboard diagram, number every arrow (
1through7), and draw a clear dividing line between the synchronous path (user waiting on an HTTP response—must be fast and stateless) and the asynchronous path (heavy CPU conversion—buffered by queues).- Pre-signed URL: A short-lived, cryptographically signed link generated by your API that lets a browser or mobile app upload/download one specific object directly to/from cloud storage (like S3) without streaming gigabytes through your API servers.
- CDN (Content Delivery Network): Globally distributed edge caches that serve immutable preview images right next to the user while shielding origin storage.
WRITE PATH (Steps 1-2 synchronous; Steps 3-5 asynchronous) [ Client ] ===(1) PUT raw file via pre-signed URL===============> [ Object Storage: Originals ] | | | (2) POST /finalize | (4) Fetch original v v [ Upload API ] +-----------------------------------------------+ | | | Single SQL transaction: v | - file_versions row [ Worker Pools: image | pdf | office | bulk ] <---+ | - renditions 'pending' [ 1 isolated sandbox subprocess per file ] | | - outbox event row | | | | v | (5c) mark | (5a) PUT | (5b) push | [ PostgreSQL ] <----------------+ 'ready' v .webp v text | | [ Object Storage: ] [ Search ] | | [ Renditions ] [ Indexer ] | +--(3) Outbox Relay--> [ Per-Lane Queues + Dead-Letter Queues ] ------------+ READ PATH (Synchronous, sub-50ms metadata check + direct edge byte delivery) [ Client ] --(6) GET /preview--> [ Preview API ] --ACL + status read--> [ PostgreSQL ] | ^ | | +--- signed CDN URLs (5m TTL) ---+ +======(7) GET page_1.webp========> [ CDN Edge ] --cache miss--> [ Object Storage: Renditions ]Highlight one crucial boundary to the interviewer: file bytes never flow through the Upload API or Preview API. API pods handle tiny JSON metadata and permission checks, while object storage and the CDN absorb multi-terabyte byte transfers.
Walk one upload and one read step by step (and why the outbox exists)
Walk the numbered arrows once so the interviewer sees every reliability handoff:
- Direct upload (
1): The client requests an upload slot andPUTs raw file bytes directly toOriginalsobject storage via a 15-minute pre-signed URL. - Atomic finalize (
2): The client callsPOST /finalize. In one PostgreSQL transaction, the Upload API records thefile_versionsrow, insertsrenditionsrows inpendingstate, updatesfiles.current_version_id, and inserts a work event into theoutboxtable. - Outbox relay (
3): A lightweight relay process polls unpublishedoutboxrows, pushes each job to its matching lane queue (image,pdf,office, orbulkfor batch migrations), and stampspublished_at. - Sandboxed conversion (
4): A lane worker claims the message, downloads the immutable original, and spawns an isolated converter subprocess under strict memory and 120-second timeout caps. - Persist outputs, then ACK (
5a–5c): The worker writes rendered.webppages to deterministic object keys (5a), sends extracted text to the search indexer (5b), marksrenditions.status = 'ready'in PostgreSQL (5c), and only then acknowledges (ACKs) the queue message. - Authorized read (
6–7): Opening a document callsPreview API, which checks permissions andrenditions.status. Ifpending, the UI renders a"Generating preview..."skeleton; ifready, the API returns 5-minute signed CDN URLs and the browser fetches crisp.webppages from the nearest CDN edge (7).
Why Step 2 uses a transactional outbox instead of publishing straight to the queue: Updating PostgreSQL and calling a message queue one after the other is a classic dual-write bug—two separate network systems updated without a shared transaction:
Naive dual write inside Upload API: 1. COMMIT file_versions in Postgres --> [ API pod crashes / queue times out here! ] 2. queue.send(job) never happens --> File stays 'pending' forever; silent data loss! Transactional outbox: 1. BEGIN -> INSERT file_versions + renditions + outbox -> COMMIT (all succeed or all roll back) 2. Relay reads outbox -> queue.send(job) -> UPDATE outbox SET published_at = now() (If Relay crashes before setting published_at, it re-sends once; idempotent workers handle it!)- Direct upload (
Define clean APIs, queue payloads, and the relational schema
Show just enough schema and API contract to prove the storage choices hold water:
HTTP Endpoints POST /v1/files/{file_id}/versions -> {version_id, upload_url} POST /v1/files/{file_id}/versions/{v}/finalize -> 202 Accepted GET /v1/files/{file_id}/preview?version={v} -> {status: "pending"|"ready"|"unavailable", thumbnail_url, page_urls[], text_ready} Queue Message Payload {file_id, version_id, lane, original_key, content_type, enqueued_at_ms} PostgreSQL Tables files (file_id PK, tenant_id, current_version_id, filename) file_versions ((file_id, version_id) PK, original_key, size_bytes, content_type, sha256, converter_failures INT DEFAULT 0, created_at) renditions ((file_id, version_id, kind) PK, -- kind IN ('thumbnail', 'pages', 'text') status, page_count, failure_reason, updated_at) outbox (id BIGSERIAL PK, lane TEXT, payload JSONB, created_at, published_at TIMESTAMPTZ)Four schema details that stand up to senior-engineer probing:
- One
renditionsrow perkind, not per page: At finalize time nobody knows whether a PDF has 2 pages or 80 pages. Storingpage_count = 10on thepagesrow once conversion finishes letsPreview APIconstruct.../pages/1.webpthrough.../pages/10.webpdeterministically without inserting 10 rows per file. - Immutable
version_ids: Uploading an edited contract createsversion_id = 2rather than overwritingversion_id = 1, preventing race conditions when a user views v1 while v2 is still rendering. - Lock-free concurrent relays: Multiple relay pods drain
outboxsafely usingSELECT id, lane, payload FROM outbox WHERE published_at IS NULL ORDER BY id LIMIT 100 FOR UPDATE SKIP LOCKED, and a daily job purges published rows older than 24 hours so the table stays tiny. sha256content hash: Enables deduplicating identical uploads within a tenant and short-circuiting known converter-crashing files.
- One
Deep dive 1: isolating untrusted, crash-prone file conversions
This is the single hardest engineering challenge in a document pipeline: parsing arbitrary user-uploaded files with complex native C/C++ engines (LibreOffice, Poppler/PDFium, ImageMagick/libvips). Crafted or corrupted files can trigger infinite loops, multi-gigabyte memory spikes, segfaults, or remote code execution—famously demonstrated by the public ImageTragick vulnerability (
CVE-2016-3714).Defense-in-depth worker architecture:
+----------------------- Kubernetes Worker Pod -----------------------+ | [ Go/Python Supervisor ] (queue heartbeat, S3 I/O, DB status) | | | spawns fresh child process per file | | v | | +-- Unprivileged Sandbox (non-root, no network, seccomp, cgroup) -+| | | Converter CLI reads /tmp/job/in.pdf -> writes /tmp/job/out/ || | | Hard caps: 2 GB RAM (Office) / 512 MB (Image), 120s wall clock || | +-----------------------------------------------------------------+| +---------------------------------------------------------------------+- One disposable subprocess per file: The worker pod runs a clean supervisor that downloads the input bytes to a fresh temp directory, forks an unprivileged child converter with zero network access and a read-only filesystem, and wipes the temp directory afterward. A native segfault, memory leak, or parser exploit dies with that single subprocess and never touches AWS credentials or other tenants' files. (Pragmatic exception: starting a subprocess adds
~50–80 ms, noticeable on300 msimage thumbnails—so the low-riskimagelane reuses a warm libvips worker across 200 images and recycles it immediately on any error.) - Bulkhead lanes eliminate head-of-line blocking: Head-of-line blocking happens when slow jobs clog the front of one shared queue while fast jobs wait behind them. Splitting queues and worker pools into
image,pdf,office(high-memory nodes), andbulk(batch tenant migrations) guarantees a 50,000-presentation enterprise import never delays interactive photo thumbnails by a single millisecond. - Accurate poison-file handling: A corrupted PDF ("poison pill") must not crash-loop workers forever, and routine pod deploys or Spot node evictions must not falsely mark a customer's valid file as broken. The supervisor increments
file_versions.converter_failuresin PostgreSQL only when the child converter itself crashes, hits its memory limit, or exceeds120 s. After 3 converter failures, the worker marksrenditions.status = 'unavailable'and routes the event to a dead-letter queue (DLQ) (a quarantine queue for failed jobs) while keeping the queue broker's rawmaxReceiveCounthigher (e.g.,10) as an infrastructure backstop.
- One disposable subprocess per file: The worker pod runs a clean supervisor that downloads the input bytes to a fresh temp directory, forks an unprivileged child converter with zero network access and a read-only filesystem, and wipes the temp directory afterward. A native segfault, memory leak, or parser exploit dies with that single subprocess and never touches AWS credentials or other tenants' files. (Pragmatic exception: starting a subprocess adds
Deep dive 2: queue-age autoscaling and idempotent at-least-once workers
Scale on oldest-message age, not CPU utilization. Our user promise is "preview ready in < 10 s", which is waiting time. CPU utilization is a misleading signal: if object storage slows down slightly, workers spend more time waiting on network I/O, CPU drops, and a CPU-based autoscaler removes workers right as the queue explodes!
- Each interactive lane scales out whenever
oldest_message_age_seconds > 5 sORqueued_messages / measured_worker_rate > 5 s, with a slow10-minutescale-down window to prevent thrashing. - Because launching a new cloud VM node takes
60–90 seconds(far longer than our10 sSLO), running steady-state pools at70%target utilization gives an instant30%burst cushion while new nodes warm up.
At-least-once queues + idempotent writes. Distributed queues guarantee at-least-once delivery: if a worker dies right after uploading previews (
5a) before sendingACK, another worker receives the same message. We make every side effect idempotent (running twice yields the exact same result as running once):- Deterministic object keys: Writing
renditions/{file_id}/{version_id}/pages/1.webpa second time overwrites the identical key cleanly—zero orphaned duplicate blobs. - Conditional SQL transitions:
- Marking ready:
UPDATE renditions SET status = 'ready', page_count = $4 WHERE file_id = $1 AND version_id = $2 AND kind = $3 AND status <> 'ready'. - Marking unavailable:
UPDATE renditions SET status = 'unavailable', failure_reason = $4 WHERE ... AND status = 'pending'—guardingstatus = 'pending'guarantees a late duplicate failure can never overwrite an already-readypreview!
- Marking ready:
- External version guard on search text: Unlike immutable versioned previews, the full-text search document represents the latest file version. Passing
version_idas an external monotonic version (version_type=externalin Elasticsearch) ensures a slowv1worker finishing afterv2gets rejected with a harmless version conflict rather than overwritingv2's newer text. - Visibility timeout heartbeats: A visibility timeout is how long a queue hides an in-flight message from other workers (say
60 s). For a 45-second slide deck, the supervisor extends visibility every20 s; if the worker VM dies, heartbeats stop and another worker retries after60 s.
- Each interactive lane scales out whenever
Deployment, DevOps topology, and golden-corpus testing
[ Git PR ] -> [ CI: Unit tests + Golden Corpus Regression (3,000 tricky PDFs/Office docs) ] | checks crash count, p95 render latency, and perceptual image diff v [ Staging ] -> [ Per-Lane Canary (5% traffic, 30 min) ] -> [ 25% -> 100% Rollout ] auto-rollback if error rate or 10s SLO burn rate spikes Production Region (3 Availability Zones, Terraform + Helm on Kubernetes) - Node pool 'general' : Upload API, Preview API, Outbox Relays (HPA on RPS/CPU) - Node pool 'cpu' : Image & PDF worker pods (KEDA autoscaler on queue age) - Node pool 'highmem' : Headless Office worker pods (KEDA autoscaler on queue age) - Node pool 'spot' : Discount interruptible VMs for 'bulk' migration lane - Managed data tier : Multi-AZ PostgreSQL (sync standby), SQS/RabbitMQ, S3, CloudFront CDNOperational details that show real production scars:
- Golden corpus testing: Most severe bugs came from routine minor-version upgrades of PDF or Office libraries. Running every library upgrade against 3,000 scrubbed real-world edge-case files (checking perceptual pixel hashes and memory peaks) caught regressions before production.
- Safe Spot instances for bulk: On a 2-minute Spot reclamation warning (
SIGTERM), the supervisor stops pulling new messages, finishes in-flight files if time permits, and never incrementsconverter_failures. - SLO burn-rate alerting: Page on-call when the 10-second preview SLO burns its monthly error budget fast, correlated via
file_iddistributed tracing fromPOST /finalizetostatus = 'ready'.
Tell the v1 -> v2 -> v3 evolution story
Frame your system's history as scale -> real failure -> targeted change -> added operational cost:
v1(~50k uploads/day) — Synchronous conversion inside the Upload API:- Why we built it: Simplest possible launch—one service, zero queues.
- How it broke: Large slide decks took
> 30 sand hit HTTP gateway timeouts, and one malformed PDF triggered an out-of-memory crash that killed 40 unrelated uploads sharing that API process.
v2(~500k uploads/day) — Single shared queue + generic worker pool scaled on CPU:- What it fixed: Uploads became fast (
< 200 ms) and immune to converter crashes. - How it broke: (1) A customer migrating 200,000
.pptxfiles caused 25-minute head-of-line blocking for simple JPEG thumbnails; (2) poison files retried endlessly; (3) CPU autoscaling lagged on I/O waits; (4) occasional network blips during dual writes left files stuck inpendingforever.
- What it fixed: Uploads became fast (
v3(~3M uploads/day) — Isolated lanes, sandboxes + DLQ, queue-age scaling, transactional outbox:- What it fixed: Each
v2outage mapped directly to onev3mechanism; interactive thumbnailp99dropped from minutes during imports to< 2 s. - Cost accepted: Managing four lane queues/pools and operating an outbox relay.
- What it fixed: Each
What I would change in hindsight: Ship the transactional outbox on day one (dual-write loss is 100% predictable), render only pages 1–3 eagerly and render pages 4+ on demand when a user scrolls (analytics showed
< 15%of opens scroll past page 3, saving ~40% of PDF/Office CPU), and deduplicate conversions by(tenant_id, sha256).Justify every technology choice and handle interviewer drill-downs
Present every technology selection as Need -> Alternatives -> Choice -> Cost & Revisit Trigger:
Need Options considered Chosen Why it won & when to revisit Storing originals & previews Postgres BYTEAblobs, NFS, Object Storage (S3)Object Storage Cheap at multi-PB scale, 11-nines durability, direct pre-signed uploads, native CDN origin. Cost: No cross-system transactions with SQL, solved via deterministic keys. File & rendition metadata PostgreSQL, DynamoDB PostgreSQL Clean relational joins/constraints + ACID transactions for the outbox; 1,200 writes/speak fits comfortably on one primary. Revisit: Shard bytenant_idpast ~15k–20k writes/s.Job distribution Per-message queue (SQS/RabbitMQ), Log stream (Kafka) Per-message queue Built-in per-message ACK, visibility-timeout extension for 45s jobs, and DLQs. In Kafka, partition count caps parallelism and one 45s Office file blocks partition offset progress unless you rebuild custom retry/DLQ topics.Worker compute Serverless (Lambda), Kubernetes containers, raw VMs Kubernetes containers Multi-hundred-MB native Office binaries, 2 GB RAM pods, and steady ~70–240core baseline made reserved container nodes ~3x cheaper than per-ms serverless billing.How to handle live drill-down questions crisply:
- "What happens if a worker VM loses power mid-conversion?" -> Visibility timeout (
60 s) expires; another worker re-runs the job; deterministic S3 keys + conditional SQL updates make partial prior writes harmless;converter_failureswas not incremented so the file doesn't lose an attempt. - "Where does this break first at 10x (
30M files/day)?" -> Walk the math:2,400peak cores (cost—turn on lazy page rendering +sha256deduplication first!) and12,000 SQL writes/son PostgreSQL (batch status updates, switch outbox polling to WAL logical replication via Debezium to drop thepublished_atwrite, then shard bytenant_id). - "Which exact pieces did you write?" -> Name concrete modules (
"I wrote the Python/Go sandbox supervisor, the KEDA queue-age scaler rules, and the conditional status state machine; my teammate built the outbox relay").
- "What happens if a worker VM loses power mid-conversion?" -> Visibility timeout (
Summary of key trade-offs
Dimension Choice made What we gave up Why it was the right trade-off Presentation depth 5-minute end-to-end map + 30-minute deep dive on worker platform Equal time on Upload API & Search Gives full context while proving senior depth on components personally built Upload vs. conversion Asynchronous after finalizeSingle-request simplicity ( v1)Uploads stay < 200 msand 99.99% available even during converter incidentsDB-to-queue handoff Transactional outbox + SKIP LOCKEDrelayDirect queue.send()from APIEliminates silent stuck- pendingfiles from dual-write crashesQueue topology Separate image,pdf,office, andbulklanesSingle unified worker pool Prevents heavy presentations and tenant migrations from starving fast thumbnails Worker execution Fresh sandboxed subprocess per file (warm pool for images) Raw throughput of long-lived shared JVM/daemon Contains native C/C++ crashes, memory leaks, and parser exploits to a single file Autoscaling metric Oldest-message queue age + 30% headroom Built-in CPU autoscaling Scales directly on the 10-second user wait-time SLO rather than misleading I/O-idle CPU
Intuition & how it works
Think of whiteboarding your past system architecture like giving an experienced head chef a guided tour of a high-volume restaurant kitchen you helped build. You don't start by reciting the serial numbers on every blender: first you take two minutes to state the dinner-rush volume (3 million files/day), promise what diners care about (95% of previews ready within 10 s), and draw a clear boundary around the station you personally engineered. Next, you trace one order from the front counter to the pickup window on a clean 6-box map, and finally you open the hood on the hardest station—showing what caught fire in v1 and how your v3 redesign fixed it. In our worked example (a cloud document preview pipeline), the core architectural idea is decoupling the fast front counter—clients uploading raw bytes straight to cloud storage via a pre-signed URL (a short-lived, cryptographically signed upload link) and recording work via a transactional outbox (inserting the outgoing job row inside the exact same SQL transaction as file metadata so database state and queue messages never drift apart)—from isolated kitchen lanes (per-file-type queues feeding sandboxed worker subprocesses that safely render untrusted images, PDFs, and heavy Office documents).
Why do simpler approaches fail—both in the interview room and in production? On the whiteboard, drawing 20 unlabeled boxes without traffic numbers or saying "we" for everything leaves the interviewer unable to judge whether your choices made sense or which code you actually wrote. In production, rendering previews synchronously inside the upload HTTP request (v1) times out on 200-page presentations and lets one corrupted file crash the entire web server with an out-of-memory error. Even moving work to a single shared background queue (v2) breaks under head-of-line blocking (slow 8-second Office conversions clogging the front of the line while 0.3-second photo thumbnails wait 20 minutes behind them) and dual-write bugs (crashing after COMMIT in PostgreSQL but before publishing to the queue, leaving files stuck in "processing" forever).
Let's trace three concurrent uploads (photo.jpg, a bulk-imported deck.pptx, and a corrupted crash.pdf) through the v3 design:
1. Upload & Atomic Finalize (Steps 1-2):
Clients PUT raw bytes directly to S3 via pre-signed URLs, then call POST /finalize.
Postgres commits file_versions + renditions ('pending') + outbox rows in ONE transaction.
2. Lane Routing via Outbox Relay (Step 3):
- photo.jpg -> 'image' queue (fast interactive lane)
- deck.pptx -> 'bulk' queue (tenant migration lane; never blocks interactive users!)
- crash.pdf -> 'pdf' queue (interactive PDF lane)
3. Isolated Execution & Idempotent Completion (Steps 4-7):
- photo.jpg renders in 0.3 s -> writes renditions/{file}/{v}/thumbnail/1.webp -> marks 'ready'
-> Preview API returns signed CDN URL -> user sees thumbnail in < 1 second!
- deck.pptx renders on cheap Spot capacity in 8 s -> marks 'ready' without delaying photo.jpg.
- crash.pdf segfaults its isolated child sandbox 3 times -> converter_failures hits 3 ->
moves to Dead-Letter Queue, marks status = 'unavailable' (UI stops spinning cleanly).
Key trade-offs
How you present in the interview:
- End-to-end breadth vs. component depth. Spending 40 minutes at 30,000 feet sounds shallow; jumping straight into a worker loop without an overview loses the interviewer. Spend ~5–8 minutes on the end-to-end 6-box map and numbers, then spend ~25–30 minutes going deep on the 1–2 subsystems you personally built (checking in with the interviewer as you transition).
- Credible specificity vs. employer confidentiality. Concrete numbers (
~35 uploads/s avg, ~120/s peak), real failure modes, and specific SQL/queue mechanics prove you lived the system, while internal codenames, customer identities, and proprietary revenue numbers are off-limits. Round traffic numbers and use generic component names. - Team credit vs. personal ownership. Saying
"I"for five people's work is dishonest, while saying"we"for every sentence hides your role. Use"we"for team-wide architecture and"I"for the specific components, schemas, or incident fixes you authored. - Defending past decisions vs. showing hindsight. Every real system carries compromises. Explain the constraints at the time (
team size,50k/day traffic,existing Postgres expertise), then proactively name 2–3 things you would redesign today given new evidence.
Inside the worked architecture:
- Synchronous vs. asynchronous rendering. Async queues require a
"preview processing"UI skeleton plus worker pools and an outbox relay to run, in exchange for keeping file uploads< 200 msand99.99%available even if converters are completely down. - Transactional outbox vs. direct queue publish. Writing to
outboxinside the PostgreSQL transaction adds one extra table write and a small polling relay (~100–200 mslag), but completely eliminates silent lost jobs from dual-write crashes. - Per-type/bulk lanes vs. one shared worker pool. Splitting
image,pdf,office, andbulklanes isolates slow or bursty workloads and letsofficerun on high-RAM nodes whilebulkruns on cheap interruptible Spot VMs, at the cost of sizing and monitoring four queues instead of one. - Fresh subprocess sandbox per file vs. long-lived in-process library. Spawning a network-less, memory-capped child process per file contains C/C++ segfaults, memory leaks, and parser exploits (
CVE-2016-3714-class bugs) at the cost of~50–80 msstartup overhead (which the low-riskimagelane amortizes across small batches of 200 files). - At-least-once delivery + idempotency vs. distributed exactly-once. Deterministic object keys (
.../{version_id}/pages/1.webp), conditional SQL updates, and Elasticsearchversion_type=externalmake duplicate runs harmless with zero distributed coordination, paying only the rare CPU cost of re-converting a file after a worker crash. - Autoscaling on oldest-message queue age vs. CPU. Queue age measures user waiting time directly so I/O-bound slowdowns still trigger scale-out, whereas built-in CPU scaling requires zero custom metrics setup but reacts late when workers block on network reads.
Common mistakes
- Picking a sprawling system you only touched on the periphery: The second
"why did you configure it that way?"probe exposes shallow familiarity immediately; pick a smaller subsystem you truly owned over a massive platform you barely touched. - Drawing boxes with zero numbers: Without QPS, payload sizes, CPU seconds per job, and latency SLOs, neither you nor the interviewer can tell whether PostgreSQL, Kafka, or Lambda is oversized or undersized.
- Mixing abstraction levels or leaving arrows unlabeled: Putting an HTTP load balancer box next to a Python helper class—or drawing two-way unlabeled arrows between services and databases—makes data flow and failure boundaries impossible to trace.
- Reciting a resume of logos instead of trade-offs: Saying "we used Kubernetes, SQS, Postgres, and S3" scores few points unless you state what alternative you rejected (
SQSvs.Kafkafor variable 45-second per-file acks) and what operational cost you paid. - Presenting
v3as ifv1never existed: Skipping the evolution story hides how you learn from incidents and scale bottlenecks. - Counting infrastructure evictions as poison-pill file failures: Relying blindly on a queue's raw
ApproximateReceiveCount == 3during rolling deploys or Spot node evictions falsely marks valid customer documents as permanentlyunavailable. - Monologuing for 25 minutes without pausing: Pause after the high-level diagram and ask, "Would you like to dive into worker sandboxing and poison-file isolation, or into the database outbox and scaling math?"
Follow-up questions
- What breaks first if your system's traffic grows by 100x, and how would you re-architect for that load? Walk the math first (
300M uploads/day,~12,000 peak uploads/s):~24,000peak busy cores makes compute cost the #1 bottleneck, and~120,000 SQL writes/sexceeds a single PostgreSQL primary. On compute, deduplicating renditions by(tenant_id, sha256)(avoiding cross-tenant instant-preview side channels that leak whether someone else owns a secret file) and rendering pages4+lazily on scroll cut worker CPU by 40–60%. On metadata, replace polling relays with Change Data Capture (CDC) reading PostgreSQL's Write-Ahead Log (WAL) and shardfiles/renditions/outboxhorizontally bytenant_id(or move to a distributed SQL / partitioned key-value store). - What was the most severe production incident this system experienced, and what architectural changes came out of it? Walk through a crisp 5-part arc: symptom -> detection -> mitigation -> root cause -> permanent fix. For example, in
v2an enterprise tenant imported 200,000 large.pptxdecks on a Monday morning, spiking interactive thumbnail latency from< 2 sto22 minutes; CPU autoscaling stayed flat because workers were waiting on large downloads, so on-call manually paused the tenant's jobs and scaled workers, then builtv3's separatebulklane, per-tenant rate limits, and queue-age autoscaling with SLO burn-rate alerts. - If you rebuilt this system from scratch today with hindsight, what architectural choices would you change? Name 2–3 concrete, evidence-backed changes rather than vague language rewrites: (1) include the
outboxtable in the initialv1 -> v2migration because dual-write drift was completely predictable, (2) build the 3,000-file golden regression corpus before the first native PDF library upgrade rather than after a customer-visible rendering bug, and (3) render only the thumbnail and pages 1–3 eagerly once product telemetry showed< 15%of previews ever scroll past page 3.
Follow-up questions
- What breaks first if your system's traffic grows by 100x, and how would you re-architect for that load?
- What was the most severe production incident this system experienced, and what architectural changes came out of it?
- If you rebuilt this system from scratch today with hindsight, what architectural choices would you change?
Similar questions
- Live SSH Log Triage and Centralized Logging Architecture
- Diagnosing and Preventing Multithreaded Lock Deadlocks
- Most Frequent Words in a File Tree
- Sliding-Window Payload Average on Out-of-Order Events
- Toggle Target Bit of an Integer
- Thread-Safe Leaky Bucket Rate Limiter
More Box interview questions
- Most Frequent Words in a File Tree Medium
- Live SSH Log Triage and Centralized Logging Architecture Medium
- Toggle Target Bit of an Integer Medium Pro
- Diagnosing and Preventing Multithreaded Lock Deadlocks Medium Pro
- Simulate a Leaky-Bucket Request Meter Hard Pro
- Sliding-Window Payload Average on Out-of-Order Events Medium Pro
- Thread-Safe Leaky Bucket Rate Limiter Easy Pro
- Top-K Word Frequencies Across Document Collections Medium Pro