Context and Problem
Organizations often have legacy systems that are difficult to replace all at once due to size, complexity, or risk factors.
- Replacing an entire legacy system in one go is risky and can cause business disruption.
- Legacy systems may be deeply integrated, making it difficult to extract or transition parts of the functionality.
- A full rewrite of a legacy system may require significant resources and time.
Solution
The Strangler Fig pattern enables a gradual migration from legacy systems to new systems by progressively replacing parts of the legacy system with new components, one at a time.
- Identify individual features or components of the legacy system that can be replaced.
- Implement new functionality in parallel to the existing system.
- Route traffic to the new system incrementally, ensuring parts of the legacy system are still in use until they are fully replaced.
- Continue replacing legacy parts over time until the entire system has been replaced with the new solution.
- Test frequently to ensure that the new system integrates well with existing components during the transition.
Benefits
- Risk Mitigation
- Gradually replacing legacy systems reduces the risk of business disruption.
- Flexibility
- Allows for incremental change, adapting to business needs and mitigating the need for a large upfront investment.
- Cost-effective
- Spreads the cost and effort of the migration over time, making it more manageable.
- Continuous Improvement
- Teams can continuously improve the system over time with each migration step.
Trade-offs
- Complexity
- The migration process adds complexity to the system, requiring careful routing and management of old and new components.
- Slower Transition
- Replacing the system incrementally takes more time than a full rewrite.
- Operational Overhead
- Managing two systems simultaneously (legacy and new) can be resource-intensive.
Issues and Considerations
- Data consistency
- Ensuring that data is kept consistent between the legacy system and the new system during the migration.
- Service coordination
- Managing the coordination between the old and new system components during the migration.
- User experience
- Maintaining a consistent user experience while shifting functionality incrementally.
When to Use This Pattern
- When replacing a legacy system entirely would be too risky or costly.
- When you need to make gradual changes without disrupting ongoing business operations.
- When a full rewrite is not feasible due to time, resources, or risk.