CloudSketch AI Logo
FeaturesTemplatesPricingEnterpriseAboutContactLog in
πŸŒ™β˜€οΈ
Log inStart free
Home/Templates/Food Delivery & QSR

πŸ” Food Delivery & QSR Β· Deployment Β· Pro

Food Delivery Peak-Hour Scaling

How a food delivery platform scales for lunch and dinner peaks: pre-scaling, autoscaling services, sharded databases and a surge-protected dispatch.

More Food Delivery & QSR templates

Deployment diagrams are part of Pro. Anyone can view this one; generating and editing it needs Pro.

Drawing diagram…

What this diagram shows

  • Capacity is pre-scaled before known peaks (festivals, cricket finals)
  • Order and dispatch services autoscale on queue depth
  • Rider locations live in a sharded in-memory store

Prompt used

Deployment for peak-hour scaling: traffic enters through CDN and API gateway with rate limiting, services run on Kubernetes with a scheduled pre-scale before lunch and dinner and autoscaling on CPU and Kafka lag. The order service writes to a sharded PostgreSQL (by city), rider GPS locations go to a sharded Redis cluster, the dispatch service batches assignments during surges, and a surge pricing service adjusts delivery fees.

Mermaid code
flowchart TB
  U[Customers, restaurants, riders] -->|"HTTPS :443"| CDN[CDN]
  CDN -->|"HTTPS :443"| GW[API Gateway - rate limits]
  subgraph K8s[Kubernetes - pre-scaled before 12:00 and 19:00]
    ORD[Order Service x N]
    DIS[Dispatch Service x N - batches in surges]
    SURGE[Surge Pricing]
    LOC[Location Ingest x N]
  end
  GW -->|"Orders, HTTP"| ORD
  GW -->|"Rider GPS, HTTP"| LOC
  ORD -->|"Order events"| KAFKA[Kafka]
  KAFKA -->|"Order events"| DIS
  DIS -->|"Demand and supply"| SURGE
  ORD -->|"Orders, SQL :5432"| PG[(PostgreSQL sharded by city)]
  LOC -->|"Rider positions, TCP :6379"| REDIS[(Redis cluster - rider GPS)]
  DIS -->|"Nearby riders lookup"| REDIS
  HPA[Autoscaler: CPU and Kafka lag] -.->|"Scale replicas"| K8s

Inside this diagram

A deployment diagram with 12 components in 1 environment and 11 connections.

Environments and what runs in them

  • Kubernetes - pre-scaled before 12:00 and 19:00: Order Service x N, Dispatch Service x N - batches in surges, Surge Pricing and Location Ingest x N

Outside these environments

  • Customers, restaurants, riders
  • CDN
  • API Gateway - rate limits
  • Kafka
  • PostgreSQL sharded by city
  • Redis cluster - rider GPS
  • Autoscaler: CPU and Kafka lag
  • K8s

Data stores

  • PostgreSQL sharded by city
  • Redis cluster - rider GPS

Connections

  • Customers, restaurants, riders β†’ CDN: HTTPS :443
  • CDN β†’ API Gateway - rate limits: HTTPS :443
  • API Gateway - rate limits β†’ Order Service x N: Orders, HTTP
  • API Gateway - rate limits β†’ Location Ingest x N: Rider GPS, HTTP
  • Order Service x N β†’ Kafka: Order events
  • Kafka β†’ Dispatch Service x N - batches in surges: Order events
  • Dispatch Service x N - batches in surges β†’ Surge Pricing: Demand and supply
  • Order Service x N β†’ PostgreSQL sharded by city: Orders, SQL :5432
  • Location Ingest x N β†’ Redis cluster - rider GPS: Rider positions, TCP :6379
  • Dispatch Service x N - batches in surges β†’ Redis cluster - rider GPS: Nearby riders lookup
  • Autoscaler: CPU and Kafka lag β†’ K8s: Scale replicas

Make your own diagram like this

Describe your own system in plain English and the AI cloud architecture diagram generator draws it in seconds, in the same style as this template.

Related templates

C4 ArchitectureProFood Delivery & QSR

Food Delivery Platform Architecture

A Swiggy/Zomato-style food delivery platform: customer, restaurant and rider apps, and the services that match orders, riders and payments.

SequenceFood Delivery & QSR

Food Order to Doorstep Sequence

Everything that happens between a customer tapping Place Order and the food arriving: payment, restaurant acceptance, rider assignment, pickup and delivery.

State MachineFood Delivery & QSR

Food Order Status State Machine

Every status of a food delivery order, from placed to delivered, including restaurant rejection, no rider and customer cancellation.

FlowchartFood Delivery & QSR

Restaurant Kitchen Order Flow

How orders from dine-in, takeaway and delivery apps flow through a restaurant kitchen display system to the pass and out.

Database ERDFood Delivery & QSR

Food Delivery Menu and Orders Schema

A schema for a food delivery platform: restaurants, menus, items with add-ons, customers, orders, order items and riders.

C4 ArchitectureProFood Delivery & QSR

Cloud Kitchen Operations Platform

A cloud kitchen that runs several virtual brands: orders from aggregators, a kitchen display system, inventory and dispatch.