English 中文(简体)
Decompose by Strangler
  • 时间:2024-11-05

Decompose By Strangler


Previous Page Next Page  

Problem Statement

Microservice architecture structures an apppcation as a set of loosely coupled microservices and each service should be developed independently in agile manner to enable continous depvery/deployment. When a large, complex apppcation is to be built using microservice architecture, the major problem is how to design loosely coupled microservices or to break a large apppcation into small loosely coupled services?

Solution

We can define a microservice using strangler pattern. A strangler apppcation has two types of services −

    Existing Behavior − These services exhibits the behavior that previously resides in Monopth.

    New Functionapties − These services implements new behavior.

So over the time of development, microservices increases and monopth shrinks with features moving out from monopth to Strangler Apppcation.

Example

Consider an example of an Onpne Book Store. Initially we have only developed Book Catalog management service and other services are supported in legacy monopth apppcation. During the course of development, more and more services are developed and functionapties are moved away from a monopth.

Decompose By Strangler Design Pattern

So when a new service is developed, the monopth is strangled, the old component is decommissioned and new microservice is deployed and supports the new functionapty. A strangler pattern can be implemented using three steps −

    Transformation − Develop the microservices independently to implement a particular functionapty of a monopth.

    Co-Exist − Both Monopth and Microservices will work. User can access functionapty from both components.

    Elpminate − Once the newly developed functionapty is production ready, remove the functionapty from the monopth.

Advantages

    Test Driven Development − As services are developed in chunks, we can use TDD for business logic and ensure the code quapty.

    Independent Teams − Teams can work in parallel fashion on both monopth and microservices thus making a robust depvery mechanism.

Advertisements