β Back to Gallery
πΏ
Strangler Fig Pattern
Definition
The Strangler Fig Pattern enables gradual migration from a legacy system to a new architecture by incrementally replacing specific pieces of functionality with new services. Named after the strangler fig tree that gradually replaces its host, this pattern allows you to modernize systems without a risky big-bang rewrite.
When to Use It
- Migrating from monolithic to microservices architecture
- Modernizing legacy applications
- You want to minimize risk during migration
- Need to maintain business continuity
- Gradual team learning of new architecture
- Budget constraints prevent complete rewrite
Pros & Cons
β Pros
- Low-risk incremental migration
- Business continuity maintained
- Faster time to value
- Easy rollback if issues occur
- Gradual team skill development
- Parallel operation of old and new
β Cons
- Longer overall migration timeline
- Maintaining both systems simultaneously
- Complex routing logic needed
- Data synchronization challenges
- Technical debt in transition period
- Requires discipline to complete
Architecture Diagram
Phase 1: Initial State (All traffic to legacy)
βββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββ
β Client β
ββββββ¬ββββββ
β
βΌ
ββββββββββββββββ
β Facade β
β (Routing) β
ββββββββ¬ββββββββ
β 100%
βΌ
ββββββββββββββββββββββ
β Legacy Monolith β
β β
β β’ Auth β
β β’ Products β
β β’ Orders β
β β’ Payments β
ββββββββββββββββββββββ
Phase 2: Partial Migration (Mixed routing)
βββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββ
β Client β
ββββββ¬ββββββ
β
βΌ
ββββββββββββββββ
β Facade β
β (Routing) β
βββββ¬βββββββ¬ββββ
β 30% β 70%
βΌ βΌ
βββββββββββ ββββββββββββββββββ
β Auth β β Legacy System β
β Service β β β
β β β β’ Products β
β (New) β β β’ Orders β
βββββββββββ β β’ Payments β
ββββββββββββββββββ
Phase 3: Advanced Migration
ββββββββββββββββββββββββββββ
ββββββββββββ
β Client β
ββββββ¬ββββββ
β
βΌ
ββββββββββββββββ
β Facade β
β (Routing) β
βββ¬βββ¬ββββ¬βββ¬βββ
β β β β
30%β20%β 30%β20%
βΌ βΌ βΌ βΌ
ββββββββββββββββββββββββββββββββ
βAuthββProdββOrdrββ Legacy β
βSvc ββSvc ββSvc ββ β
β ββ ββ ββ β’ Payments β
β(Newβ(Newββ(Newββ β
ββββββββββββββββββββββββββββββββ
Phase 4: Complete Migration
ββββββββββββββββββββββββββββ
ββββββββββββ
β Client β
ββββββ¬ββββββ
β
βΌ
ββββββββββββββββ
β API Gateway β
βββ¬βββ¬ββββ¬βββ¬βββ
β β β β
βΌ βΌ βΌ βΌ
βββββββββββββββββββββββββ
βAuthββProdββOrdrββ Pay β
βSvc ββSvc ββSvc ββ Svc β
βββββββββββββββββββββββββ
[Legacy System Decommissioned]
Migration Steps:
1. Add routing facade
2. Identify service to extract
3. Build new service
4. Route traffic gradually
5. Verify functionality
6. Decommission legacy component
7. Repeat for next component