Friday, October 28, 2022

Microservices Design Patterns - Strangler Pattern

Microservices are getting more and more popular these days. Many companies are migrating their monolith applications to microservices. However this is easier said than done. Decomposing a monolith with microservices comes with a lot of challenges. In this article we will learn about the Strangler Pattern that can be used to decompose or refactor a monolith into microservices.

The Strangler Pattern gets its name from the Strangler Fig tree. This type of a tree grows around a host tree. The roots wrap around the host tree, widen, and slowly form a lattice-work that surrounds the host’s trunk. The fig’s crown grows foliage which soon overshadows the tree. Eventually, the host tree dies leaving the fig with a hollow trunk.

The Strangler Pattern is a popular design pattern to incrementally transform your monolithic application into micro services by replacing a particular functionality with a new service. Once the new functionality is ready, the old component is strangled, the new service is put into use, and the old component is decommissioned altogether. Any new development is done as part of the new service and not part of the Monolith.


Initially, all application traffic is routed to the legacy application. Once the new component is built, you can test your new functionality in parallel against the existing monolithic code. Both the monolith and the newly built component need to be functional for a period of time. Sometimes the transitional phase can last for an extended duration. When the new component has been incrementally developed and tested, you can get rid of the legacy monolithic application.

No comments:

Post a Comment