Strangler Fig Pattern
Modernize an application gradually. Without taking it offline.
Old systems mean old code using outdated architectures. Code that often needs updating or replacing with new code that enables modern features with enhanced capabilities running in modern architectures. Unfortunately, much of this old code is found in complex, monolithic legacy applications that make it extremely challenging to identify and manipulate pieces of code without causing collateral impact. Commonly, bits of old code remain with a cut-over rewrite, even if it has bugs or limits functionality.
Martin Fowler, Chief Scientist of Thoughtworks, coined Strangler Fig for software in 2004 after being inspired by a literal strangler fig tree. Its seeds germinate in the upper branches of a neighboring tree, and their roots surround the tree until they make their way to the ground where they take root. Eventually, the roots strangle and replace the host tree entirely. What does this analogy have to do with software? It provides an accurate illustration of how system architects can effectively approach monolithic legacy applications in need of modernization.
What Is the Strangler Fig Pattern?
The Strangler Fig pattern enables architects to gradually replace legacy code with microservices until the monolith is eventually strangled — without disabling the legacy system while those improvements and additions are made. Strangler Fig buys organizations time, but most importantly, it enables frequent, smaller release cycles that bring incremental value sooner and give architects the opportunity to monitor progress to inform future releases.
How Does the Strangler Fig Pattern Work?
The Strangler Fig Pattern involves a façade that intercepts requests going to the backend legacy system and routes them either to the legacy application or the new service. Over time, as the application becomes more modernized, the Strangler façade routes more requests to the new system than the old until the legacy system becomes less relevant and the full migration is complete. The legacy system is then considered “strangled,” and the new system is the only system in use. All of this happens without the end user noticing the migration.
Strangler Fig Pattern Resources
Why App Modernization Projects Fail
Application modernization projects often never begin, sometimes due to a lack of awareness, a business case, tools or skill sets. Even if an architect gets the green light and begins the process, studies show nearly 80% of modernization projects fail. We partnered with Wakefield Research to discover why and how developers can avoid the same fate.
Is the Strangler Fig Pattern the Solution to Your Mono to Microservices Modernization Problem?
There are a few ways to approach application modernization, but how do you know which one to implement? Sometimes the Strangler Fig Pattern isn’t ideal. Learn how to evaluate solutions, key considerations, and why modernization needs continuous, automated monitoring to reduce risk and increase success.
How to Use the Strangler Fig Pattern for Application Modernization
Go into greater depth into the Strangler Fig Pattern origins and how it works, with graphics to illustrate the migration process. You’ll also learn the benefits of this approach to application modernization and implementation best practices with vFunction and AWS Refactor Spaces.
Why Some Monoliths Need to Migrate to Microservices
As organizations move to modernize applications to prepare them for the cloud, optimize them with modern features to keep them valuable, or reduce catastrophic failure, they often come to the realization that their architecture is predominantly composed of monolithic, legacy applications. But there’s a problem: it’s nearly impossible to change a single function in a monolith because each function is intertwined with another function, leading many developers to migrate these massive, tightly coupled applications to easier-to-manage microservices.
Gartner defines microservices as an application component that is tightly scoped, strongly encapsulated, loosely coupled, independently deployable and independently scalable. It also warns that while a microservices architecture has significant benefits, migration often fails because developers don’t fully understand why, when and how to do it.
The beauty of the Strangler Fig approach is that it automates the slow decommissioning of outdated and costly legacy applications without significantly disrupting operations. If a change in code impacts the app, developers can simply reverse the microservices deployment or adjust the code and test again. The Strangler Fig Pattern eliminates the tedious, labor-intensive task of reviewing millions of lines of code and tens of thousands of classes manually.
Here’s a more detailed explanation of how the Strangler Fig Pattern works:
- As new microservices are added, the façade works seamlessly in the background to redirect any requests for a specific function from the old monolith to the new microservice.
- The strangler application tests the microservice(s) in parallel with the original code to verify both respond the same.
- Once the microservice passes the test, the façade automatically sends all future requests for that function to the microservice, bypassing the original app for that request.
- With each microservice that’s added and functionality verified, another piece of the original app is replaced until the entire monolithic application is strangled.
Modernization is challenging enough. Doing it without adding risk, complexity and cost takes it to another level. The Strangler Fig Pattern addresses all of these potential roadblocks head-on, offering at least seven benefits.
- Allows incremental updating
- Enables quicker modernization
- Minimizes risk
- Allows for customized modernization pace
- Allows easy and seamless rollbacks
- Eliminates the need to maintain two separate codebases
- Enhances QA
What’s more, refactoring with Strangler Fig helps developers avoid potentially destructive software design patterns, appropriately termed “anti-patterns” by none other than Martin Fowler. Spaghetti Code. Golden Hammer, Boat Anchor, dead code, proliferation of code, and God Object (a.k.a. Swiss Army Knife) are the most common anti-patterns. Fowler says these look like legitimate solutions until their true shortcomings appear later, one of the worst being adding to technical debt instead of minimizing it.
A Guide to Application Modernization
Learn the basics of application modernization as part of a comprehensive digital transformation strategy, barriers to modernizing, and the risks of carrying too much technical debt. Read how digital transformation takes place and use cases in the financial services industry.
Microservices, Monoliths, and Tech Debt – Oh My!
Get insight on what’s driving so many CIOs to place application modernization as a top three priority, how to prioritize monolith transformation, and where to find a balance between speed and risk with a microservices architecture.
Breaking Bad Code: Automating the Strangler Fig Pattern
The Strangler Fig pattern is an effective modernization technique ideal for complex and legacy .NET and Java monolithic applications. Discover how Amazon (AWS) and vFunction automate Strangler Fig to help users modernize applications faster and with less risk.