0
0
Microservicessystem_design~12 mins

Why resilience prevents cascading failures in Microservices - Architecture Impact

Choose your learning style9 modes available
System Overview - Why resilience prevents cascading failures

This system demonstrates how resilience techniques in a microservices architecture prevent cascading failures. It shows how components like circuit breakers, retries, and fallback services help isolate failures and keep the system stable under stress.

Architecture Diagram
User
  |
  v
Load Balancer
  |
  v
API Gateway
  |
  +-------------------------+
  |                         |
  v                         v
Service A (with Circuit Breaker)   Service B (with Retry & Fallback)
  |                         |
  v                         v
Database A                Database B
  |
  v
Cache
Components
User
user
Initiates requests to the system
Load Balancer
load_balancer
Distributes incoming requests evenly to API Gateway instances
API Gateway
api_gateway
Routes requests to appropriate microservices and enforces resilience policies
Service A (with Circuit Breaker)
service
Handles business logic with circuit breaker to stop calls to failing downstream services
Service B (with Retry & Fallback)
service
Handles business logic with retry attempts and fallback responses on failure
Database A
database
Stores persistent data for Service A
Database B
database
Stores persistent data for Service B
Cache
cache
Speeds up data access and reduces load on databases
Fallback Service
service
Provides fallback responses when Service B fails
Request Flow - 13 Hops
UserLoad Balancer
Load BalancerAPI Gateway
API GatewayService A (with Circuit Breaker)
Service A (with Circuit Breaker)Database A
Database ACache
CacheService A (with Circuit Breaker)
Service A (with Circuit Breaker)API Gateway
API GatewayService B (with Retry & Fallback)
Service B (with Retry & Fallback)Database B
Service B (with Retry & Fallback)Fallback Service
Service B (with Retry & Fallback)API Gateway
API GatewayLoad Balancer
Load BalancerUser
Failure Scenario
Component Fails:Database B
Impact:Service B's database queries fail causing retries and eventual fallback responses. Without resilience, this failure could overload Service B and API Gateway, causing cascading failures.
Mitigation:Retry logic limits repeated attempts, fallback service provides default responses, circuit breakers prevent overload, isolating failure and maintaining system stability.
Architecture Quiz - 3 Questions
Test your understanding
Which component prevents Service A from repeatedly calling a failing database?
ACache
BLoad Balancer
CCircuit Breaker in Service A
DAPI Gateway
Design Principle
This architecture uses resilience patterns like circuit breakers, retries, and fallbacks to isolate failures and prevent them from spreading. Caches reduce load on databases, further stabilizing the system. These techniques together stop one failure from causing a chain reaction, keeping the system responsive and reliable.