0
0
Microservicessystem_design~12 mins

Event store concept in Microservices - Architecture Diagram

Choose your learning style9 modes available
System Overview - Event store concept

An event store system records all changes in the form of events. It supports microservices by storing events as the source of truth. Key requirements include reliable event storage, event replay, and supporting asynchronous communication between services.

Architecture Diagram
User
  |
  v
Load Balancer
  |
  v
API Gateway
  |
  v
Command Service ---> Event Store ---> Event Bus ---> Multiple Microservices
                              |
                              v
                        Snapshot Store
Components
User
client
Initiates commands or queries to the system
Load Balancer
load_balancer
Distributes incoming requests evenly to API Gateway instances
API Gateway
api_gateway
Routes requests to appropriate services and handles authentication
Command Service
service
Receives commands, validates them, and writes events to the event store
Event Store
database
Stores all events in an append-only log for durability and replay
Event Bus
message_queue
Publishes events asynchronously to interested microservices
Multiple Microservices
service
Consume events to update their own state or trigger actions
Snapshot Store
database
Stores periodic snapshots of state to speed up event replay
Request Flow - 7 Hops
UserLoad Balancer
Load BalancerAPI Gateway
API GatewayCommand Service
Command ServiceEvent Store
Event StoreEvent Bus
Event BusMultiple Microservices
Multiple MicroservicesSnapshot Store
Failure Scenario
Component Fails:Event Store
Impact:New events cannot be stored, causing command failures; event replay and state recovery are blocked
Mitigation:Use replication and backups for event store; fallback to read-only mode from snapshots and caches; alert operators for quick recovery
Architecture Quiz - 3 Questions
Test your understanding
Which component ensures commands are evenly distributed to avoid overload?
ALoad Balancer
BEvent Bus
CSnapshot Store
DAPI Gateway
Design Principle
This architecture uses event sourcing to store all changes as events in an append-only log. It decouples command processing from state updates by asynchronously publishing events via an event bus. Snapshots optimize recovery by reducing replay time. Load balancing and API gateway ensure scalability and security.