0
0
LLDsystem_design~12 mins

Proxy pattern in LLD - Architecture Diagram

Choose your learning style9 modes available
System Overview - Proxy pattern

The Proxy pattern provides a placeholder or surrogate for another object to control access to it. It is used to add additional functionality like access control, lazy loading, or logging without changing the original object's code.

Key requirements include controlling access to the real object, possibly delaying its creation, and adding extra behavior transparently.

Architecture Diagram
User
  |
  v
Proxy
  |
  v
Real Subject
  |
  v
Resource
Components
User
client
Initiates requests to access the resource
Proxy
proxy
Controls access to the Real Subject, adds extra behavior like access control or caching
Real Subject
service
The actual object that performs the core operations
Resource
resource
Underlying data or service used by the Real Subject
Request Flow - 7 Hops
UserProxy
ProxyProxy
ProxyReal Subject
Real SubjectResource
ResourceReal Subject
Real SubjectProxy
ProxyUser
Failure Scenario
Component Fails:Proxy
Impact:User requests cannot be processed or access control fails, potentially exposing Real Subject directly or blocking access
Mitigation:Implement fallback mechanisms or redundant proxies; ensure Real Subject has its own access controls
Architecture Quiz - 3 Questions
Test your understanding
What is the main role of the Proxy in the Proxy pattern?
ATo store the underlying resource data
BTo replace the User in sending requests
CTo control access to the Real Subject and add extra behavior
DTo directly process all user requests without forwarding
Design Principle
The Proxy pattern demonstrates how to add a control layer between a client and a service to manage access, add caching, or delay expensive operations, improving modularity and flexibility without changing the core service.