Introduction to System Design

The Pizza Shop Analogy

Imagine we run a pizza shop. It starts becoming successful and our daily customers start to increase, now what will you do ? Expand or Give poor service ? This is what system design is ! Let’s explore foundational system design concepts through this analogy -

  • Vertical Scaling - Ask a chef to work faster or smarter. vertical-scaling
  • Pre-processing & Cron Jobs - Prep the pizza dough in advance during off-peak hours. pre-processing
  • Resilience via Backup - Keep a backup chef ready. resillience
  • Horizontal Scaling - Hire more chefs. horizontal-scaling
  • Microservices Architecture - Specialize! Two chefs handle pizzas, one handles garlic bread. Route orders based on expertise. microservice
  • Distributed Systems - Open more branches of the pizza shop. Route orders to the nearest store. This is partitioning by geography. distributed-systems
  • Load Balancing - Use a central system to route customer orders to the shop with the shortest wait time. load-balancing
  • Decoupling - Delivery agents operate on their own system. Their work is independent of the pizza shop internals. decoupling
  • Logging & Metrics - Track orders, delays, ingredients. Find patterns, improve quality.

Disclaimer - This analogy was given by Gaurav Sen, by far the best explanation for system design.


What is System Design ?

System design is the process of defining components data flows, APIs, and integrations to build large-scale systems that meet a specified set of functional (e.g., order pizza, payments) and non-functional requirements (e.g., 99.9% uptime, low latency).

Phases in design process

  1. Requirement Analysis - Identify functional requirements (e.g., order pizza, payments) and non-functional requirements (e.g., 99.9% uptime, low latency).
  2. System Decomposition - Break system into components (e.g., frontend, api, databases, external services etc).
  3. Architecture Design - Define how components interact (e.g., communication patterns-REST,gRPC, data flows and storage decisions).
  4. Technology Choices - Select techn-stack based on requirements.
  5. Make a HLD(High level design) diagram.

System Design in Agile Methodology

In Agile, you start building quickly and deliver in small increments and design evolves as the product grows. This means there is no grand design phase, just start with enough architecture, ex- just one database but keep in mind the awareness that this needs to scale. Iteratively keep refining the design