Architecture Patterns: Strangler Pattern
The Strangler Pattern enables gradual, low-risk software migration but demands careful balancing of two systems during the upgrade process.
Join the DZone community and get the full member experience.
Join For FreeThe Strangler Pattern, first described by Martin Fowler, is a software architectural pattern that describes a method of gracefully migrating a legacy system incrementally rather than in a big-bang approach. It is named after the Strangler Fig, a type of vine that slowly grows on a tree and eventually replaces it. Similarly, in the software context, the Strangler Pattern involves building a new system around the boundaries of the old system, allowing you to slowly replace parts of the old system with components of the new system over time.
Many Software engineers will be confronted with system migration in their careers; technology is growing faster, and humans need time to adapt and maintain their systems, which can become old sometimes even before they have time to finish it. A strangler pattern is an approach that allows migration without a big bang, which can be very stressful for teams and is often condemned to failure. This pattern is very efficient in the context of large systems because it allows people to gain confidence in the ability to make the migration, providing a multitude of small successes that are much harder to achieve in a one-shot.
The general approach is to identify areas of the old system that can be replaced and then gradually route new requests or functionality to the new system. At the same time, the old system still handles the legacy functionality. Over time, as the new system becomes more robust and feature-complete, more and more functionality is transitioned over until the old system can be safely retired.
Benefits
- Incremental Migration: Instead of a high-risk, big-bang release, you can migrate to the new system step by step, ensuring that the new components work properly before moving on.
- Reduces Risk: By breaking down migration into smaller, manageable chunks, it reduces the risk associated with major changes.
- Maintain Business Continuity: Throughout the migration process, the business can continue to operate using the existing system, ensuring that there’s no loss of functionality or downtime.
- Facilitates Modernization: This pattern is particularly useful when transitioning from monolithic architectures to microservices, as you can gradually replace monolithic components with microservices.
- Flexibility: Since the migration happens over time, it allows teams to adjust and refine their approach based on feedback from earlier migration stages. It is also suitable for use with modern software development methods such as Agile iterative methods.
- Parallel Development: While the new system is being developed, changes can still be made to the old system if necessary.
- Stakeholder Trust: Migrations are often a big deal for IT teams, especially because they represent a large investment with an ROI that can be difficult to measure. If accepted, small signs of dysfunction can make everyone very worried because of the high-risk situation from their point of view. In a sort of strangler pattern, with smaller chunks, the stress could be much more localized to a particular chunk or a bunch of chunks. That helps a lot to manage stress at a C level.
- Focus on Business Value: By only migrating small parts, you can focus on the most important parts or those that will benefit the most from the migration. In this way, by migrating small parts of a monolithic system, you can enable completely new business for your company, simplify some critical points, etc.
Trade-Offs
- Complexity: Managing two systems simultaneously can be complex. Ensuring compatibility, routing requests, and maintaining the state between the two can be challenging.
NB: Consider the case of an old system with executables and multiple local databases living alongside a modern centralized web application. Coordinating and versioning the databases will be very challenging.
- Resource Intensive: Both the old and new systems might need to run concurrently, requiring additional infrastructure and maintenance resources.
- Potential for Drift: As development progresses, there’s a risk that the new system might drift in terms of features or functionality from the old one, especially if changes continue to be made to the legacy system.
- Duration: The transition can be lengthy, especially for large, deeply integrated systems. This prolonged transition period can lead to increased costs and resource allocation for the migration.
- Team Alignment: The team needs to be aligned in terms of goals, understanding of the legacy system, and the migration strategy to ensure successful implementation of the Strangler Pattern.
Conclusion
The Strangler Pattern emerges as a compelling approach for managing the evolution of software systems in a world where change is the only constant. By allowing for the gradual replacement of components of a legacy system, this pattern offers a strategic roadmap for organizations navigating the complexities of technological advancement.
The incremental nature of the pattern aligns well with contemporary Agile practices, affording teams the ability to adapt, inspect, and adjust throughout the migration process. This not only maintains business continuity but also helps in cultivating stakeholder trust by demonstrating consistent progress and reducing the anxiety associated with large-scale system overhauls.
However, the Strangler Pattern is not without its challenges. The complexities inherent in running and gradually transitioning between two systems should not be underestimated. It demands a disciplined approach to coordination, comprehensive testing, and a keen eye for maintaining feature parity where needed.
The key to a successful Strangler Pattern implementation lies in meticulous planning, clear communication, and a phased approach to deployment that prioritizes business value. It is an exercise in balance — between old and new, speed and stability, and investment versus return.
As software engineers, the Strangler Pattern equips us with a pragmatic framework for ensuring that our systems can evolve without disrupting the vital services they provide. In the lifecycle of software, the Strangler Pattern is not merely a method for system migration — it is a manifestation of the evolutionary nature of technology itself. It’s about ensuring that as our software matures, it can continue to support the ever-changing landscape of business needs, remaining robust, relevant, and resilient in the face of change.
Published at DZone with permission of Pier-Jean MALANDRINO. See the original article here.
Opinions expressed by DZone contributors are their own.
Comments