0
0
Microservicessystem_design~12 mins

Strangler fig pattern in Microservices - Architecture Diagram

Choose your learning style9 modes available
System Overview - Strangler fig pattern

The Strangler Fig pattern helps replace a legacy system gradually by building a new system around it. It routes user requests to either the old system or the new microservices, allowing smooth migration without downtime.

Key requirements include seamless request routing, data consistency, and minimal disruption to users during migration.

Architecture Diagram
User
  |
  v
Load Balancer
  |
  v
API Gateway
  |
  +--------------------------+
  |                          |
  v                          v
Legacy System           New Microservices
  |                          |
  v                          v
Legacy Database         New Database
  |
  v
Cache
Components
User
client
End user making requests
Load Balancer
load_balancer
Distributes incoming requests evenly to API Gateway instances
API Gateway
api_gateway
Routes requests to legacy system or new microservices based on routing rules
Legacy System
service
Existing monolithic application serving some requests
New Microservices
service
New modular services gradually replacing legacy functionality
Legacy Database
database
Stores data for legacy system
New Database
database
Stores data for new microservices
Cache
cache
Speeds up data access for both systems
Request Flow - 11 Hops
UserLoad Balancer
Load BalancerAPI Gateway
API GatewayLegacy System or New Microservices
Legacy System or New MicroservicesCache
CacheLegacy System or New Microservices
Legacy System or New MicroservicesLegacy Database or New Database
Legacy Database or New DatabaseLegacy System or New Microservices
Legacy System or New MicroservicesCache
Legacy System or New MicroservicesAPI Gateway
API GatewayLoad Balancer
Load BalancerUser
Failure Scenario
Component Fails:Legacy Database
Impact:Legacy system cannot read or write data; requests routed to legacy system fail or degrade
Mitigation:API Gateway routes affected features to new microservices if possible; cache serves stale data for reads; database replication and failover restore service
Architecture Quiz - 3 Questions
Test your understanding
Which component decides whether a request goes to the legacy system or new microservices?
ALoad Balancer
BCache
CAPI Gateway
DLegacy Database
Design Principle
The Strangler Fig pattern enables gradual replacement of a legacy system by routing requests through an API Gateway that directs traffic to either the old or new system. This approach reduces risk by allowing incremental migration, maintaining service availability, and enabling coexistence of old and new components.