How do you modernize a legacy monolith application to a microservices architecture? – Very often, the answer that you would hear is ‘Strangler Pattern’.
Strangler Pattern is a way of migrating a legacy system incrementally by replacing existing functionalities with new applications
and services in a phased approach. After the replacement of the entire functionality the new application system eventually replaces all the old legacy system's features. The name "strangler pattern" was inspired from strangler fig trees.
A big bang application approach or completely replacing a complex system with microservices can be a huge risk. So, adopting the strangler pattern to gradually migrate into a new system reduces the risk of a complete failure. However, running two separate versions of an application means that clients must know where each feature is located. Every time a feature or service is migrated, clients need to be updated to point to the new location. Strangler pattern overcomes this challenge of accessing multiples applications by creating a routing facade.
The routing facade intercepts requests going to the backend legacy system and routes these oncoming requests either to the legacy application or the new application. The client’s interface continues the old way unaware that any technology migration has taken place or is in progress.
The challenge in implementing this pattern is to be able to evaluate the functionalities and dependencies to identify components for separation and figure out the right migration strategy. In a complex legacy system, especially when the original developers of the core functionality are no longer there, it’s hard to be certain where to “cut” and how to adapt the software architecture correctly. You have to be able to make tradeoffs between complexity of target architecture and the desired level of functional separation.
To split your legacy application into fine-grained functions that are lightweight, independently deployable, scalable, and portable, you need to:
Here's a pictorial view of strangler pattern implementation, showing the architecture transformation from legacy to microservices.
Once the migration is complete, the strangler interface facade will either go away or evolve into an adaptor for legacy clients. Strangler pattern’s clear benefit is to minimize risk in migration and to plan the development effort over time. As all features are migrated to the new system, the old legacy system is eventually "strangled" and ready to sunset/retire.
By the way, the above pictures of software architectures are all real images made with the new CAST Imaging. CAST Imaging ingests your legacy system (the biggest one we analyzed so far with CAST Imaging is 13.5 million lines of code) and creates a visual representation of all of its components – from mobile interface down to the RDBMS. This makes deploying the Strangler Pattern much more plausible, because instead of hunting in the dark you can easily navigate and see all the impacted dependencies in whatever area of the application you’re trying to separate. You can take a look at a 1-minute video description of CAST Imaging below.
You can also get a first-hand experience and complimentary access to CAST Imaging by clicking here.