0
0
LLDsystem_design~12 mins

Delivery agent assignment in LLD - Architecture Diagram

Choose your learning style9 modes available
System Overview - Delivery agent assignment

This system assigns delivery agents to customer orders efficiently. It ensures orders are matched with available agents nearby, considering agent capacity and location to optimize delivery speed and resource use.

Architecture Diagram
User
  |
  v
Load Balancer
  |
  v
API Gateway
  |
  v
Assignment Service <--> Agent Location Service
  |                     |
  v                     v
Order Database       Agent Database
  |
  v
Cache (for recent assignments)
Components
User
client
Customer placing delivery orders
Load Balancer
load_balancer
Distributes incoming requests evenly to API Gateway instances
API Gateway
api_gateway
Handles client requests, routes them to appropriate services
Assignment Service
service
Assigns delivery agents to orders based on availability and location
Agent Location Service
service
Tracks real-time locations and statuses of delivery agents
Order Database
database
Stores order details and assignment records
Agent Database
database
Stores delivery agent profiles and availability
Cache
cache
Stores recent assignment data for quick access
Request Flow - 10 Hops
UserLoad Balancer
Load BalancerAPI Gateway
API GatewayAssignment Service
Assignment ServiceCache
Assignment ServiceAgent Location Service
Assignment ServiceAgent Database
Assignment ServiceOrder Database
Assignment ServiceCache
Assignment ServiceAPI Gateway
API GatewayUser
Failure Scenario
Component Fails:Agent Location Service
Impact:Assignment Service cannot get real-time agent locations, leading to possible suboptimal agent assignments or delays
Mitigation:Fallback to cached agent locations in Cache; alert system operators; degrade to less precise assignment logic temporarily
Architecture Quiz - 3 Questions
Test your understanding
Which component is responsible for distributing incoming user requests evenly?
AAPI Gateway
BAssignment Service
CLoad Balancer
DCache
Design Principle
This design uses caching to reduce database load and improve response times. It separates concerns by using dedicated services for assignment logic and agent location tracking. Load balancing and API gateway ensure scalability and security. Failure handling includes graceful degradation using cache fallback.