patternMajorpending
Pattern: Strangler Fig for incremental system migration
Viewed 0 times
strangler-figmigrationlegacyincrementalfacadeproxy
Problem
Rewriting a legacy system from scratch is risky (big bang migration). The new system might not handle all edge cases, and you can't deliver value incrementally.
Solution
Gradually replace the old system piece by piece:
- Route all traffic through the new layer
- Initially, the facade just forwards to the old system
- Start with the simplest, most well-understood features
- Route those requests to the new implementation
- Legacy system handles everything else
- Send requests to both, compare responses
- Log differences for investigation
- Only switch when confident
- Eventually, no traffic goes to the old system
- Decommission it
Nginx routing example:
location /api/users {
proxy_pass http://new-service; # Migrated
}
location /api/ {
proxy_pass http://legacy-system; # Not yet migrated
}
Key principles:
- INTERCEPT: Place a facade/proxy in front of the legacy system
- Route all traffic through the new layer
- Initially, the facade just forwards to the old system
- REPLACE: Implement new functionality one route at a time
- Start with the simplest, most well-understood features
- Route those requests to the new implementation
- Legacy system handles everything else
- VERIFY: Run both systems in parallel (shadow mode)
- Send requests to both, compare responses
- Log differences for investigation
- Only switch when confident
- RETIRE: Remove legacy routes as they're replaced
- Eventually, no traffic goes to the old system
- Decommission it
Nginx routing example:
location /api/users {
proxy_pass http://new-service; # Migrated
}
location /api/ {
proxy_pass http://legacy-system; # Not yet migrated
}
Key principles:
- Never break the running system
- Each step is independently deployable and reversible
- New and old coexist — no big bang cutover
- Start with features that have the most to gain
Why
Like the strangler fig tree that grows around its host, the new system gradually replaces the old one while the old system continues working.
Revisions (0)
No revisions yet.