Migrating to Microservices
1. Assessing Monolith Architecture
| Question | Detail |
|---|---|
| Pain points? | Deploy speed, team coupling, scaling |
| Domains? | Bounded contexts |
| Data coupling? | Shared tables, FKs |
| Don't decompose | If monolith works fine |
2. Identifying Service Boundaries
| Method | Detail |
|---|---|
| Event Storming | Domain events → aggregates |
| Team topology | Conway's Law alignment |
| Business capability | Per capability service |
3. Using Strangler Fig Pattern
| Step | Detail |
|---|---|
| Façade | Proxy in front of monolith |
| Route | New endpoints → new service |
| Migrate | One capability at a time |
| Decommission | Old code when traffic = 0 |
4. Implementing Anti-Corruption Layer
| Aspect | Detail |
|---|---|
| Translates | Legacy model ↔ new domain |
| Isolates | New service from legacy quirks |
| Removed when | Legacy retired |
5. Extracting Services Gradually
| Order | Detail |
|---|---|
| Edge first | Read-only, low-risk |
| Then writes | Outbox + dual-write |
| Finally core | When confidence is high |
6. Managing Data Migration
| Step | Detail |
|---|---|
| Dual-write | Write to old + new |
| Backfill | Historical via CDC |
| Read switch | Shadow then cutover |
| Decommission | Stop dual-writes |
7. Implementing Feature Parity
| Practice | Detail |
|---|---|
| Inventory features | Old → new mapping |
| Acceptance tests | From legacy behavior |
| No new features | Until parity |
8. Testing During Migration
| Technique | Detail |
|---|---|
| Shadow / mirror | Compare outputs |
| Diff tooling | scientist-style |
| Canary | Slow traffic shift |
9. Managing Team Transition
| Element | Detail |
|---|---|
| Team topologies | Stream-aligned, platform, enabling |
| Skill gaps | Training: K8s, observability |
| On-call | You build it, you run it |
10. Handling Rollback Scenarios
| Tactic | Detail |
|---|---|
| Feature flag | Flip back to monolith path |
| Façade route | Revert routing rule |
| Keep dual-write | Until cutover trusted |
11. Using Branch by Abstraction
| Step | Detail |
|---|---|
| Add abstraction | Interface around old impl |
| New impl | Behind same interface |
| Switch | Flag-driven swap |
| Remove old | Once stable |
12. Implementing Parallel Run Strategy
| Aspect | Detail |
|---|---|
| Both run | Old + new on every request |
| Compare | Log diffs to investigate |
| Authoritative | Old until new proven |
| Risk | Side-effects must be idempotent |