System Design AI

How to Run the Hour: A Structure for Any System Design Interview

You walk into a system design interview with a blank whiteboard and a clock ticking. The goal isn’t just to propose a solution; it’s to demonstrate a disciplined thought process that fits into a one-hour slot. Below is a practical, minute-by-minute guide that works for junior, senior, and staff-level interviews. The structure is flexible enough to adapt to any question—whether you’re asked to design a URL shortener, a ride-hailing service, or a real-time chat system.

1. Clarify the Problem (2-3 minutes)

What to say out loud

  • Restate the core request: “You want a service that shortens URLs and redirects users to the original link.”
  • Ask clarifying questions about scope: "Are we supporting analytics, custom aliases, or expiration?"
  • Confirm any constraints: "Do we need to support 100 M requests per day?"

Why it matters

  • Shows you listen and avoid assumptions.
  • Gives you a shared definition that guides the rest of the interview.
  • If you discover a hidden requirement early, you can allocate time for it later.

When you fall behind

  • If the interview drags on, politely summarize what you’ve understood and ask to move on: "I think we have the core use case; can we start sketching the architecture?"

2. Gather Requirements (5-7 minutes)

Functional Requirements

  • Basic create-short-URL API.
  • Redirect endpoint.
  • Optional analytics (click count, referrer).
  • Custom alias support.

Non-Functional Requirements

  • Scalability – handle roughly 100 M requests per day (~1,200 req/s).
  • Latency – <100 ms for redirect.
  • Durability – no loss of mappings.
  • Security – prevent abuse, rate-limit creation.
  • Observability – metrics, logs, tracing.

What to say

  • List each requirement, note any trade-offs, and prioritize with the interviewer: "If we had to drop one, I’d start with custom aliases because they add complexity."

Recovery tip

  • If you spend too long on this list, condense it: "We’ll focus on create, redirect, and durability; analytics can be added later."

3. Define Entities & API Contracts (5 minutes)

Entities

EntityKey FieldsReason
URLMappingshortCode, longURL, createdAt, ownerIdCore data to store.
ClickLogshortCode, timestamp, referrer, userAgentFor analytics.
RateLimitip, timestamps[]To enforce abuse protection.

API Sketch

Text
POST /api/shorten { longURL, customAlias? } → { shortCode }
GET /{shortCode} → 302 redirect to longURL
GET /api/analytics/{shortCode} → { clickCount,... }

What to say

  • Briefly walk through each endpoint, the request/response shape, and error cases (e.g., alias conflict).
  • Highlight idempotency where relevant.

If you’re behind

  • Skip the table and verbally enumerate the main objects and two endpoints; the interviewer will fill in details.

4. High-Level Architecture (8-10 minutes)

Core Components

  1. API Layer – stateless front-end (e.g., AWS API Gateway or Nginx) that validates input.
  2. Application Service – business logic (e.g., AWS Lambda or containerized service) handling creation, lookup, and rate-limiting.
  3. Storage – durable key-value store for mappings (e.g., DynamoDB) and a separate store for analytics (e.g., ClickHouse or Redshift).
  4. Cache – read-through cache (e.g., ElastiCache Redis) for hot redirects.
  5. CDN – edge caching of redirect responses for low latency.
  6. Monitoring – CloudWatch metrics, X-Ray tracing.

Diagram Walkthrough

  • Start with the client request hitting the API layer.
  • Show the flow: API → Lambda → DynamoDB (write) → return shortCode.
  • For redirects: client → CDN edge → cache check → if miss, Lambda reads DynamoDB → cache update → 302.
  • Mention async pipelines (Kinesis → Lambda → analytics DB) for click logging.

What to say

  • Explain why each piece is chosen: DynamoDB gives single-digit millisecond reads/writes and auto-scales; Redis reduces latency for the hot path.
  • Note any alternative designs (e.g., using a relational DB) and why you prefer the presented stack.

Recovery tip

  • If time runs short, drop the CDN layer and say it’s an optimization you can add later.

5. Deep Dives (20-25 minutes)

Pick 2-3 components that matter most for the problem. Typical choices: storage schema, scaling the redirect path, and abuse protection.

5.1 Storage Schema & Consistency

  • Partition key: shortCode.
  • Attributes: longURL, createdAt, ownerId.
  • Consistency: Strong reads for redirects to avoid stale data; eventual consistency is acceptable for analytics.
  • Capacity planning: 100 M writes per day ≈ 1,200 writes/s; DynamoDB can provision on-demand throughput or use auto-scaling.
  • Failure handling: Retry with exponential backoff; fallback to a secondary read-replica.

5.2 Redirect Path Performance

  • Cache hit ratio: If 80 % of redirects hit Redis at about 22 ms end to end and the rest take about 40 ms on a miss, average latency ≈ 0.8 × 22 + 0.2 × 40 ≈ 26 ms.
  • Cold miss: DynamoDB read ≈ 10 ms, plus Lambda overhead ≈ 30 ms; still under 100 ms.
  • Scaling: Redis clusters horizontally; Lambda scales automatically; CDN edge nodes add another layer of latency reduction.

5.3 Abuse & Rate Limiting

  • Token bucket per IP stored in Redis with TTL.
  • Burst: 10 requests per second; sustain: 100 per minute.
  • Implementation: Increment counter atomically; if limit exceeded, return 429.
  • Edge case: Distributed attacks—use WAF rules to block suspicious IP ranges.

What to say

  • Walk through the algorithm, illustrate a small example, and discuss trade-offs (e.g., memory usage vs. precision).
  • Mention monitoring alerts for spikes.

If you run out of time

  • Summarize the deep dive in one sentence and move to the next component; the interviewer often probes further if interested.

6. Operational Concerns (5-7 minutes)

  • Deployment – CI/CD pipeline using CodePipeline; blue-green deployment of Lambda versions.
  • Testing – Unit tests for business logic, contract tests for API, chaos testing on cache failures.
  • Observability – Metrics: request latency, error rates, cache hit ratio; logs include request IDs for traceability.
  • Disaster Recovery – DynamoDB point-in-time recovery, cross-region replication for read-only fallback.

What to say

  • Briefly list each concern, note the tool you’d use, and why it matters for the service’s SLA.

7. Wrap-Up (2-3 minutes)

  • Recap the core design: "We have a stateless API front-end, Lambda business logic, DynamoDB for durable mappings, Redis cache for fast redirects, and a CDN for edge latency.
  • Highlight the biggest trade-off you made: e.g., choosing a key-value store over a relational DB for simplicity and scale.
  • Offer next steps: "We could add analytics pipelines, implement custom alias collision handling, and introduce multi-region replication for higher availability."
  • Ask if the interviewer wants deeper detail on any part.

If you’re behind

  • Deliver the recap first, then ask which area they’d like to explore further. This shows you can prioritize and adapt.

How to practice this

  1. Pick a random design prompt (e.g., design a video streaming platform) and set a timer for 60 minutes.
  2. Follow the structure above, speaking each step out loud as if in an interview. Record yourself to catch filler or hesitation.
  3. Draw the final architecture on a whiteboard or in a digital canvas, then review it with System Design AI’s coach to get feedback on completeness and clarity.

Questions people ask

How much time should I spend on the high-level diagram?

Aim for 8-10 minutes. Sketch the main components, explain why you chose each, and be ready to dive deeper on demand.

What if I don’t know the exact throughput limits of a service?

Give a ball-park figure, explain how you’d estimate it (e.g., requests per day ÷ seconds per day), and note that you’d validate with load testing.

How do I handle a situation where the interviewer pushes me into a detail I haven’t prepared?

Acknowledge the gap, outline the approach you would take to solve it, and suggest moving back to a higher-level view if time is limited.

Should I mention specific cloud providers?

Yes, naming a concrete service (e.g., DynamoDB, Redis) helps demonstrate practical knowledge, but keep the focus on the design rationale rather than vendor marketing.