
Migrating From a Monolith to Microservices Without Downtime
Treating a monolith decomposition as a 48-hour weekend cutover is the mistake that burns a working product. Teams schedule the maintenance window, miss revenue, surface data drift between old and new stores, and roll back the following week with a bill and no new architecture.
Zero-downtime migrations take longer on paper and ship every sprint. The work is a sequence of boring changes: pull one bounded context out of the monolith, route a sliver of traffic to its new service, prove it against the old path, widen the pipe, repeat. Every step is individually reversible, which is the whole point.
The Strangler-Fig Sequence That Actually Ships
Martin Fowler named the Strangler Fig pattern in 2004 as a way to replace a legacy system by building new functionality around it until the old one retires. The sequencing on a real codebase matters more than the metaphor.
Start with a read-only endpoint whose output is deterministic: a product detail lookup, a tax calculation, a notification render. Wrap it behind an internal API inside the monolith so every caller already talks to an interface. Lift that interface into a new service with its own repo, build pipeline, and SLO. Route calls through a feature flag or reverse-proxy rule, not a hardcoded URL. Only after that first read service is stable in production do you touch write paths.
Order of extraction, in practice:
- Read-only lookups and reports: lowest risk, highest observability
- Asynchronous work: notifications, exports, scheduled jobs
- Write endpoints with narrow ownership: inventory, pricing, user profile
- The transactional core: checkout, ledger, auth
Call the last tier last, and only if the team genuinely needs independent deploy cadence for it. A core ledger extracted too early is the most common source of the data drift incident that forces a rollback.
Dual-Write Database Cutovers Without Data Drift
The database is where most of these projects die. Two services cannot share one write-master and claim to be independent, and the same data isolation discipline that separates tenants in a SaaS applies between services. The expand-and-contract pattern breaks the move into small individually safe steps so the database is always in a state where both old and new code work.
Sequence a typical cutover: add the new columns or tables without reading from them; dual-write to both schemas behind a feature flag; backfill historical rows in batches; switch reads to the new store with the old still dual-written as a safety net; compare row counts and checksums; stop writing to the old schema; drop it.
Each step runs in production. Each is reversible until the final drop, which is scheduled only after a week or two of clean read parity. This is where most of the calendar time goes, and where cutting corners later shows up as orphaned rows and reconciliation tickets.
- 11. Build and deploy the new schemaDesign and implement the new structure alongside the existing one.
- 22. Expand the interfaceClients write to both old and new structures while still reading from the original.
- 33. Migrate existing dataTransfer and transform historical rows into the new schema.
- 44. Test the new interfaceValidate correctness and performance against the new structure.
- 55. Cut reads overRedirect client reads from the old schema to the new one.
- 66. Stop writing to the old structureDiscontinue writes to the legacy schema.
- 77. Remove the original structureDrop the deprecated schema to finalize the migration.
Shadow Traffic Before Real Users See It
Routing real users at a new service without a dress rehearsal is faith, not engineering. Shadow traffic duplicates production calls at the ingress and sends one copy to the legacy path (which answers the user) and one copy to the new service (whose response is compared and discarded).
Pipe the comparison into a structured log with field diffs, latency distributions, and error classes, and treat any divergence above a tiny threshold as a bug in the new service. Teams that skip this step learn about currency rounding, timezone handling, and null-vs-empty-string differences from a customer complaint instead of a dashboard.

Shadow runs also calibrate the operational SLOs. The new service's p99 latency, memory footprint, and connection-pool behavior under real load are only observable once real load is on it. A week of shadow traffic is cheap. A bad cutover is not.
Blue-Green and Canary Cutovers at the Edge
When the new service matches the old on shadow traffic, cut over at the edge, not inside the monolith. Blue-green deployment runs two identical production environments with the router flipping between them after health checks pass, which keeps rollback at the seconds scale. Canary deployments gradually shift traffic in steps, trading a slower rollback for finer-grained observation.
Pick blue-green for stateless request handlers where the schema is compatible and the risk is in code. Pick canary for anything with cold caches, warm pools, or user segmentation where a 1% slice reveals behavior that a 100% cut would mask. Many teams run both: blue-green at the service level, canary at the routing level inside the green environment.
The 2024 DORA report tags 19% of respondents as elite performers who deploy on demand with roughly 5% change failure and recover inside an hour. Those numbers are the target, not the starting line.
What This Costs and How Long It Takes
A realistic decomposition for a mid-sized monolith (a Rails or Django app, 200k-500k lines, 20-50 engineers) runs 9 to 18 months and extracts 4 to 8 services, not 40. Platform costs during the transition typically rise 20 to 40% because both environments run in parallel, then settle near the pre-migration baseline once the old monolith's footprint contracts.
Line-item ranges on a representative engagement:
- Platform engineering: 2 engineers for the full window, $500k-$800k loaded
- Service extraction: a rolling pair of engineers per service, 6-10 weeks each
- Observability stack: $60k-$150k annualized for tracing, log aggregation, and SLO tooling
- Dual-run infrastructure: 20-40% uplift for 6-12 months
- API integration and contract tests: scoped per service
- Data reconciliation: one engineer continuously through the final cutover
The platform the extracted services usually land on is Kubernetes, and the hiring and tooling market now assumes it. For an honest comparison of rehost, refactor, and rebuild tradeoffs before committing, the ranges above are a floor, not a ceiling.
When the Right Answer Is Fewer Services
Amazon Prime Video's Video Quality Analysis team collapsed its serverless audio/video monitoring architecture into a monolith on EC2 and ECS, cutting infrastructure costs by over 90% and raising the service's scaling ceiling. That is not an argument against decomposition. It is an argument against decomposition without a hypothesis.
A bounded context earns its own service when it has an independent deploy cadence, a different scaling profile, a separate data model, or a distinct team. If it has none of those, it is a module, and a module inside a well-structured monolith is cheaper to run and faster to change than the same code behind a network hop. Debugging complexity, operational overhead, and network latency are the drivers in every honest post-mortem of consolidation.
Before the first extraction, write the one-paragraph case: which service, which boundary, which independent-deploy or scaling pressure justifies the split. Teams that cannot write that paragraph for service four or service five are the ones that reconsolidate 18 months later.
The Decomposition That Lets the Business Keep Running
The 48-hour weekend cutover ends in a rollback because it has no safety net. The sequence above ships every sprint and keeps the lights on: strangler-fig extraction of one bounded context at a time, expand-contract schema changes, shadow traffic against the legacy path, blue-green and canary at the edge, and a written hypothesis before any service earns its own repo.
For teams planning a first extraction in the next two quarters, the hard decision is which bounded context goes first, not whether to decompose at all. Pick a read-only endpoint, extract it in six weeks, and let that one teach the sequencing the second needs. A disciplined engineering partner delivers the work as scoped service pairs, not a theory piece.
