0
0
LLDsystem_design~12 mins

When to use which structural pattern in LLD - Architecture Diagram

Choose your learning style9 modes available
System Overview - When to use which structural pattern

This system helps developers decide which structural design pattern to use based on their software needs. It guides users through common scenarios and suggests the best pattern to organize code structure for maintainability, scalability, and clarity.

Architecture Diagram
User
  |
  v
Load Balancer
  |
  v
API Gateway
  |
  v
Decision Service <--> Pattern Knowledge Base
  |
  v
Response Service
  |
  v
Cache
  |
  v
Database
Components
User
user
Person requesting pattern advice
Load Balancer
load_balancer
Distributes incoming requests evenly to backend services
API Gateway
api_gateway
Handles client requests, routes to appropriate services
Decision Service
service
Analyzes user input and selects the best structural pattern
Pattern Knowledge Base
database
Stores information about structural patterns and usage scenarios
Response Service
service
Formats and sends pattern recommendation back to user
Cache
cache
Stores recent pattern recommendations for faster response
Database
database
Persistent storage for user queries and pattern data
Request Flow - 12 Hops
UserLoad Balancer
Load BalancerAPI Gateway
API GatewayCache
CacheAPI Gateway
API GatewayDecision Service
Decision ServicePattern Knowledge Base
Pattern Knowledge BaseDecision Service
Decision ServiceCache
Decision ServiceResponse Service
Response ServiceAPI Gateway
API GatewayLoad Balancer
Load BalancerUser
Failure Scenario
Component Fails:Cache
Impact:Cache misses increase, causing more database queries and higher latency
Mitigation:System falls back to querying Pattern Knowledge Base directly; add cache replication and monitoring to reduce downtime
Architecture Quiz - 3 Questions
Test your understanding
Which component first checks if a pattern recommendation is already available to speed up response?
AAPI Gateway
BDecision Service
CCache
DLoad Balancer
Design Principle
This architecture demonstrates the use of caching to improve response times and reduce load on the database. It also shows separation of concerns by dividing responsibilities among services: decision making, data storage, and response formatting. Load balancing ensures scalability and availability.