Course contentsShow
← Cloud and Infrastructure
Lesson 2598 of 2,98955. Microservices on CloudFree lesson

Strangler Fig Pattern for Migration

Apply strangler fig pattern to incrementally migrate from monolith to microservices without big-bang rewrites.

Strangler Fig Pattern for Migration

What You'll Learn

You'll learn how to safely migrate a monolithic application to microservices by gradually replacing functionality piece-by-piece, avoiding risky "big-bang" rewrites.

The Core Idea

The Strangler Fig Pattern is named after a type of vine that grows around a tree, eventually replacing it entirely. In software migration, you build new microservices alongside your existing monolith, gradually routing traffic to the new services while the old system continues running. Over time, the monolith shrinks as more functionality moves to microservices, until it can be retired completely.

Think of it like renovating a house while you're still living in it—you replace one room at a time rather than demolishing everything and camping in the yard.

How It Works

  1. Identify a boundary: Choose a well-defined piece of functionality (using domain-driven design principles)
  2. Build the new service: Create a microservice that implements that functionality
  3. Route selectively: Use an API Gateway or routing layer to direct requests for that feature to the new service
  4. Run in parallel: Both old and new systems handle their respective requests
  5. Validate and expand: Once stable, repeat for the next boundary

The monolith continues serving all other requests until each piece is successfully migrated.

Why It's Valuable

This approach minimizes risk by allowing incremental rollbacks, continuous testing in production, and steady progress without downtime. You maintain business continuity while modernizing your architecture. If a new service fails, you simply route traffic back to the monolith temporarily.

Key Takeaway:
The Strangler Fig Pattern enables safe, incremental migration from monolith to microservices by building new services alongside the old system and gradually shifting traffic, eliminating the need for dangerous all-at-once rewrites.