Prasoon Soni

All writing

Strangling a monolith without stopping the business

· 6 min read · Architecture, Microservices, Migration

Rewrites are seductive and dangerous. The temptation, when you inherit a large monolith, is to freeze it, build the replacement in a corner, and flip a switch. In a system that moves real money, that switch is where careers go to die. Here is how we modernized a private-label credit card transaction system without ever asking the business to hold still.

The Strangler Fig

The pattern is named after a vine that grows around a host tree, gradually taking over until the original is gone. Applied to software, you place a routing layer in front of the monolith and, service by service, redirect individual capabilities to new implementations. The monolith keeps serving everything you have not moved yet.

The goal is never "the rewrite is done." The goal is that on any given day, the system is a little more new and a little less old — and always shippable.

How we sliced it

We picked seams, not layers. Instead of extracting "the database layer" or "the UI," we carved off vertical slices of behavior — a whole capability the monolith owned — and stood each one up as its own service behind the router.

  • Start with a read-only or low-risk capability to prove the routing and observability story.
  • Route a small percentage of traffic first; compare outputs against the monolith before cutting over fully.
  • Keep the new service backward-compatible at the contract boundary so callers never notice the swap.
  • Delete the strangled code from the monolith as soon as the new path is trusted — dead code left behind is a lie waiting to be believed.

Making the new services boring

The interesting part of a payment service is that it should be deeply uninteresting to operate. Every extracted service shipped with the same resilience toolkit: idempotency keys so retries never double-charge, circuit breakers around downstream calls, exponential backoff, and structured logging that let us trace a single transaction across service boundaries.

Callers
  • Card transactions
Routing
  • RouterSends each capability to its owner
Owners
  • Transactions serviceMigrated
  • Enrichment serviceMigrated
  • MonolithEverything else, shrinking
Callers never notice a swap: the router sends each capability to whichever side owns it today.

What I would tell my past self

Invest in the routing and observability layer before you extract anything. The migration is only as safe as your ability to compare old and new, and to roll back in seconds. The pattern is simple; the discipline is the hard part — resist the urge to move two things at once, and always leave the system shippable.