MigrationSenior Backend Engineerteam: 12 engineersclient: E-commerce, magazine subscriptions

Monolith-to-microservices migration

Moving a legacy VB monolith to separate UIs, APIs and databases while the system stayed in use.

Oct 2022Sep 2023

3 + 4 + 3

UIs, APIs and databases out of one VB monolith

How it was measured

A count of what runs in production after the split: 3 UI applications, 4 APIs and 3 databases.

0

downtime during data migration

How it was measured

No maintenance window was scheduled, and uptime monitoring showed no outage while production data moved to the new databases.

On this page
  1. 01Context
  2. 02Problem & constraints
  3. 03Architecture
  4. 04Key decisions
  5. 05Results
  6. 06What I'd do differently
  7. 07Stack
01

Context

The platform sells magazine subscriptions through more than 100 branded storefronts. Its legacy core was a Visual Basic monolith: UI, business logic and data in one piece.

The goal was to split it into separate UIs, APIs and databases without stopping the system for the data migration.

02

Problem & constraints

  • The data had to move with zero downtime.
  • One codebase had to become 3 UIs, 4 APIs and 3 databases with clear boundaries.
  • Old and new parts had to work side by side during the move.
03

Architecture

Scroll the diagram sideways

fig. 01: Before and after. One VB monolith becomes 3 UIs, 4 APIs and 3 databases.From VB monolith to the new UIs, APIs and databases, with zero-downtime data migration. From the UIs to the APIs. From the UIs to the APIs, second path. From the APIs to the databases. From the APIs to the databases, second pathVB monolithUI + logic + dataUI 01UI 02UI 03API 01API 02API 03API 04DB 01DB 02DB 03zero-downtimedata migration
fig. 01Before and after. One VB monolith becomes 3 UIs, 4 APIs and 3 databases.
04

Key decisions

DR-01

Zero-downtime data migration instead of a maintenance window

Context
Production data had to move to new databases.
Options considered
A: stop the system, export and import. B: migrate the data while the system keeps running.
Trade-offs
B needs more tooling and more checks. A is cheaper to build and stops the business for the length of the migration.
Outcome
Chose B. The data migration ran with zero downtime.
DR-02

Split by responsibility: 3 UIs, 4 APIs, 3 databases

Context
In the monolith, UI, logic and data were deployed and changed together.
Options considered
A: move the monolith to a new stack as one unit. B: split it into separate UIs, APIs and databases.
Trade-offs
B means more deployables and more contracts between them. Each part can then change on its own.
Outcome
Chose B: 3 UIs, 4 APIs and 3 databases.
05

Results

  • Each UI, API and database is now released on its own, so a change no longer means redeploying the whole system.
  • Old and new parts ran side by side until the move was complete, so users saw no change.
  • Legacy stored-procedure logic for address hygiene and fulfillment batches moved into .NET background services.
  • SQL import views carried publisher agreements, categories, subscriptions and banking data into the new schema before the September 2023 cutover.
06

What I'd do differently

  • I would start with a full inventory of what the monolith does, including scheduled jobs and reports, before planning the split.
  • I would add contract tests between the new UIs and APIs from the first release.
  • I would split the databases in smaller steps, one domain at a time, so each release is easy to roll back.
07

Stack

  • VB (legacy)
  • C#
  • .NET
  • ASP.NET Core
  • SQL Server
  • EF Core
  • Dapper
  • Redis
  • AWS
  • TeamCity