Strangler Fig Pattern
Incremental migration strategy that gradually replaces a legacy system with new components, progressively routing traffic until the old system can be retired.
What it is
The Strangler Fig pattern (named after the strangler fig tree) is a strategy for migrating legacy systems incrementally. Instead of a complete rewrite — the dreaded "big bang" that fails more often than it succeeds — new components are built that gradually replace functionality from the old system while it continues operating.
Martin Fowler described it in 2004, inspired by the strangler figs of Australia: seeds that germinate in the canopy of a host tree, grow roots downward, and eventually envelop and replace the original tree.
Why it matters
Complete rewrites are the graveyard of software projects. The Strangler Fig pattern offers a pragmatic alternative:
- Controlled risk — each migration is small and reversible
- Continuous value — the legacy system keeps working while the new one is built
- Incremental learning — the team discovers hidden legacy requirements gradually, not at the end
- Sustainable funding — continuous investment is justifiable because each iteration delivers value
Process
- Place a proxy/facade in front of the legacy system — this is the control point for routing traffic
- Implement new functionality in the new system for a specific route or feature
- Gradually route traffic to the new system (by percentage, user, or region)
- Validate and monitor — compare behavior between both systems
- Repeat until legacy receives no traffic
- Retire the legacy system when no longer needed
When to use it
- Monolithic systems that need modernization but cannot stop
- Database migrations where consistency is critical
- On-premise to cloud transitions
- Replacement of obsolete frameworks or languages
When not to use it
- Small systems where a rewrite takes less than a sprint
- When the legacy system has no clear interface to intercept
- If there is no way to selectively route traffic
Variants
| Variant | Mechanism | When to use |
|---|---|---|
| Strangler Fig (classic) | HTTP proxy gradually redirects traffic | Migrating web monolith to microservices |
| Branch by Abstraction | Internal code abstraction | Replacing internal components without changing the API |
| Parallel Run | Run both systems and compare | When correctness is critical (payments, calculations) |
| Feature Toggle | Feature flags control which users see the new system | Gradual migration by user segment |
References
- Strangler Fig Application — Martin Fowler, 2004. The original article that named the pattern.
- Legacy Application Strangulation — Paul Hammant, 2013. Real-world case studies of the pattern in practice.
- Strangler Fig Pattern — Azure — Microsoft, 2024. Pattern implementation guide.