To modernize a legacy monolith to microservices without downtime, put a routing layer in front of it and extract one well-bounded slice at a time. Move each slice's data with change data capture and expand-and-contract schema changes, then shift traffic gradually behind tests and monitoring. At every step you can route traffic back to the monolith.
Below are the decisions behind that method. It reflects how our Platform Modernization teams move critical legacy systems onto cloud-native platforms while the business keeps running.
Do you actually need microservices, or a better-structured monolith?#
You need microservices only if your problem is independent deployment, scaling or team ownership. If the real problem is tangled code, a modular monolith is the cheaper fix.
Martin Fowler's Monolith First essay explains why. Microservices carry a "MicroservicePremium", the cost of running a suite of services, and they "only work well if you come up with good, stable boundaries" between them. Split along the wrong boundaries and you get a distributed monolith: every change still touches several services, now over the network.
Match the symptom to the fix before you commit:
| Symptom | Likely fix |
|---|---|
| One module needs to scale far more than the rest | Extract that module as a service |
| Teams block each other on a shared release train | Extract services along team boundaries |
| A component needs a different runtime or release cadence | Extract it |
| Code is hard to change, but deploys are fine | Modularize inside the monolith first |
| Builds and tests are slow | Fix the pipeline and test suite first |
| The platform is end-of-life (OS, framework, data centre) | Re-platform first, decompose later |
Many teams draw module boundaries inside the monolith first, then extract the modules that prove stable. That way each boundary is tested before it becomes a network call.
How do you pick the first slice of the monolith to extract?#
Pick a slice with a clear boundary, few data dependencies and real value, where getting it wrong is cheap to undo. Don't start with the transactional core.
Score candidates on five criteria:
- Boundary clarity. Can you name its inputs and outputs in one sentence?
- Data coupling. How many tables does it share with other modules? Fewer is better.
- Change frequency. Does the business change this area often? If so, extracting it pays back every sprint.
- Blast radius. If it fails, does checkout stop, or does an email arrive late?
- Observability. Can you measure its current latency, error rate and volume today?
Notifications, document generation, search, and read-only catalogue or pricing lookups often score well. Payments, order state and anything with complex cross-module transactions usually come later. By then the routing, data sync and rollback steps have been proven on something smaller. Our Cloud Migrations practice follows the same rule: a low-risk workload goes first, so the runbook is proven before anything critical moves.
How does the strangler pattern keep the system live during migration?#
The strangler fig pattern puts a façade in front of the monolith. The façade sends each request to either the legacy code or the new service, so you can move traffic route by route while the system keeps serving users.
Microsoft's Azure Architecture Center describes it as a way to replace specific pieces of functionality step by step until the old system can be decommissioned. The existing application keeps running throughout. In practice, the sequence for each slice is:
- Insert the façade with no behaviour change. All traffic still goes to the monolith. This step tests the proxy (an API gateway, load balancer rules or a reverse proxy) on its own.
- Build the new service behind the façade, with no live traffic yet.
- Shadow or compare. Mirror requests to the new service and compare its responses with the monolith's, without returning them to users.
- Shift a small share of traffic, for example internal users or a few per cent of requests.
- Ramp up while error rates and latency stay inside agreed limits.
- Delete the legacy code path once the slice has run at 100% long enough to trust it.
With routing in one place, rollback is a configuration change, not a redeploy.
How do you migrate data without downtime or double-writes going wrong?#
Give the new service its own data store and keep it in sync with log-based change data capture. Make schema changes with expand-and-contract, and have exactly one system own writes for an entity at any time.
Application-level dual writes, where code writes to both databases in sequence, are where most data migrations go wrong. One write succeeds, the other fails, and the two stores drift apart without anyone noticing. Two patterns avoid this:
- Log-based change data capture (CDC). It reads the database's transaction log instead of the application. The Debezium documentation notes that it captures all data changes, including deletes, and needs no changes to your data model. For MySQL or PostgreSQL, the delay is in the millisecond range.
- Transactional outbox. When a service has to update its database and publish an event, it writes the event to an outbox table in the same transaction. Per microservices.io, messages are then sent if and only if the transaction commits.
For schema changes, parallel change (also called expand and contract) splits a breaking change into reversible steps. A typical data move for one slice looks like this:
Reconcile with row counts, checksums and sampled record comparisons before you switch reads, then again before you switch writes. After writes move, sync changes back to the legacy tables for a while. That keeps the monolith current, so falling back doesn't lose data.
What tests and observability need to be in place before each cutover?#
Before any traffic moves, you need tests that pin down the monolith's current behaviour and monitoring that compares the old and new paths side by side. Without a baseline, you can't tell whether the new service is worse.
Tests:
- Characterization tests that record what the monolith does today, including its quirks
- Contract tests between the façade, the monolith and the new service
- End-to-end tests on the user journeys that cross the slice
- Load tests on the new path at peak volume, not average volume
- Security and dependency checks on the new service and its infrastructure
Observability:
- Service level objectives for the slice, set from the monolith's measured baseline
- Distributed tracing across the façade, monolith and service, so one request can be followed end to end
- Dashboards that split error rate, latency and throughput by route: legacy versus new
- Data reconciliation alerts that fire when the two stores drift apart
- Alerts wired to the rollback triggers below
Our Observability & SRE practice sets SLOs and instruments with OpenTelemetry for exactly this kind of comparison. Every release also passes the same three gates we apply to all work, whether a person or an AI wrote the change: tested, secured and reviewed by a senior engineer.
What does a rollback plan look like for every step?#
A rollback plan names the action and the trigger for each step and gives each step an owner. The team rehearses it before the cutover. The goal is that only one step in the whole migration can't be undone, and it happens last.
| Step | Rollback action | Trigger or precondition |
|---|---|---|
| Insert façade | Remove the proxy or bypass it in DNS/load balancer | Added latency above budget |
| Shift traffic | Set the route weight back to 0% | Error rate or p95 latency breaches the SLO |
| Switch reads | Point reads back to legacy tables | Reconciliation mismatch |
| Switch writes | Move writes back; reverse sync has kept legacy current | Failed transactions, data drift |
| Contract old schema | None. This is the point of no return. | Only after a full soak period with no rollbacks |
| Delete legacy code | Restore from version control, but the old data paths are gone | Only after the contract step is complete |
Agree on the triggers in numbers before the cutover, such as "error rate above X% for five minutes", so nobody has to argue about it during an incident. Rehearse each rollback in a staging environment, and time it.
How do you sequence modernization so delivery doesn't stop?#
Run modernization as part of the roadmap, not as a freeze beside it. Extract slices in the areas where you're already building features, and keep only one cutover in flight per team.
- Pair extraction with feature work. If the roadmap says pricing changes next quarter, extract pricing first. The new feature then ships in the new service.
- Limit work in progress. One slice per team, taken from extraction to legacy deletion before the next one starts. Half-migrated slices are where the cost builds up.
- Freeze narrowly. Freeze only the slice being cut over, and only for the days around the switch.
- Same team builds and runs. The engineers who extract a service carry its on-call during the soak, so they find the problems first.
- Budget capacity explicitly. Set aside a fixed share of each sprint for modernization. Report progress in slices retired, not tickets closed.
The first slice teaches the most: how long reconciliation really takes, which dashboards were missing and how fast a rollback runs. Treat it as a pilot with success criteria agreed up front, then decide whether to use the same approach on the next slice.
Conclusion#
Moving from a monolith to microservices without downtime is a sequence of small, reversible moves: a façade, one slice, synchronized data, gradual traffic and a rehearsed way back. Decide first whether you need services at all. Prove the method on a low-risk slice, and save the point of no return for the very end.
If you're planning this for a business-critical system, we can start with a paid pilot: one pod embedded with your experts, one slice, success criteria agreed up front. Talk to an engineering lead →
Frequently asked questions
How long does it take to move a monolith to microservices?
It depends on how many slices you extract and how tangled the shared data is, so you can't plan a reliable timeline before the first slice is done. Taking one low-risk slice all the way from façade to legacy deletion tells you your real cycle time for routing, data sync and cutover. Plan the rest of the migration from that number, not from an upfront estimate.
Can we modernize the monolith and move to the cloud at the same time?
Yes, but run them as separate, phased steps. Moving the monolith and splitting it in one cutover makes it hard to tell what caused a problem. Often the safer order is to re-platform first, with a rollback plan for each phase, and then extract services.
Should every microservice have its own database?
Each service should own its data and be the only system that writes to it. Other services get that data through APIs or events, not by querying its tables directly. During migration, change data capture keeps the legacy database and the new store in sync until ownership has fully moved.
Is it safe to use AI coding tools during a modernization?
AI tools can speed up writing characterization tests, adapters and new service code. Every change still needs tests, security checks and senior engineer review, whether a person or an AI wrote it. During a migration, the parallel-run comparison between the old and new paths is the best check that generated code behaves like the legacy system.
What if we extract a service and the boundary turns out to be wrong?
That's the reason to keep the legacy path and reverse sync until after a soak period. If the boundary is wrong, route traffic back to the monolith, merge or redraw the module, and try again. Moving functionality between services is harder than inside a monolith, so it's cheaper to test boundaries as modules first.
- Microservices
- Legacy Modernization
- Strangler Fig Pattern
- Change Data Capture
- Platform Engineering
Newsletter
Get new articles by email
A short monthly round-up of what we've written on engineering pods, quality and AI. No spam.
