In Module 3, Verdalia decided not to split its store into services, and in June 2027 it confirmed the decision. It extracted a single piece, notifications, and stopped there. Rutalia, the parcel delivery company that ships its orders, is in the opposite situation: it has 45 developers, six teams, and a twelve-year-old monolith that no longer lets them work. In this lesson you will follow its migration with the eight-step method. You will learn the Strangler Fig pattern, which makes it possible to replace a system without stopping it, and you will see how service boundaries are found, in what order services are extracted, how a shared database is split up, and what replaces transactions when an operation crosses several services. You will also see what went wrong, which teaches as much as what went right.
Germán, architect at Rutalia, tells the story at the Valencia meetup on October 21, 2027. Rutalia is a fictitious company, as are all its figures.
Step 1: Functional Requirements and Scope
Rutalia picks up packages at stores and warehouses, and delivers them all over Spain. Its system, called Central, does five things:
| Area | What it does | Who uses it |
|---|---|---|
| Intake | Registers shipments, calculates the rate, and prints the labels | Stores, such as Verdalia |
| Routing | Assigns each shipment to a route and a van | Planners |
| Tracking | Records each label scan and reports where the package is | Recipients, stores, and couriers |
| Billing | Charges the stores and issues the invoices | Stores and administration |
| Customers | Store portal, contracts, and users | Stores |
The scope of a migration is defined differently from that of a new system. You do not decide what the system will do, but what is not going to change:
| In | Out |
|---|---|
| Extract services, one at a time, with the system running | Rewrite Central from scratch |
| Keep the functions and the addresses the stores use | Add new functions while a service is being extracted |
| Remove the code of what has been extracted from the monolith | Extract every area: some can stay |
The rule in the second row is the hardest to keep. Migrating and changing behavior at the same time makes it impossible to know, when something fails, which of the two broke it.
Step 2: Quality Attributes and Scenarios
The starting point, measured in 2025:
| Measure | Value |
|---|---|
| Size of Central | 1.4 million lines, in a single application |
| Database | One, with 310 tables and 1.8 TB. 58 tables are read by two or more teams |
| Build and tests | 3 hours and 40 minutes. 5,200 tests, and 4% fail intermittently |
| Deployments | 2 a month, on Thursdays at 11:00 p.m., with 3 hours of work |
| Lead time for a change | 34 days median |
| Deployments with an incident | 38% |
| Time to recover | 5 hours and 20 minutes median |
| Serious incidents | 14 in the year |
The worst one happened on Friday, November 28, 2025. The tracking queries of the campaign saturated the database, and for 2 hours and 10 minutes the couriers could not record their deliveries. A read-only function had stopped the deliveries.
The scenarios that management accepted:
| Scenario | Stimulus | Expected response |
|---|---|---|
| RS-1, maintainability | A team finishes a change in its area | In production in under 2 days, without coordinating with another team |
| RS-2, scalability | Tracking queries multiply by 4 | Intake and delivery do not notice |
| RS-3, availability | A piece of Central is replaced by a service | No outage. Rollback in under 5 minutes |
| RS-4, operability | A deployment fails | Fewer than 10% of deployments. Recovery in under 30 minutes |
Step 3: Scale Estimates
| Quantity | Calculation | Result |
|---|---|---|
| Shipments | 120,000 a day on average. 310,000 during the campaign | 3.6 million a month |
| Shipment registrations per second | 120,000 / 86,400 | 1.4 on average |
| Tracking queries | 24 per shipment: 120,000 × 24 | 2.88 million a day, 33 per second |
| Tracking during the campaign | 310,000 × 24 / 86,400, times 4 at the peak hour | 344 per second |
| Label scans | 9 per shipment: 120,000 × 9 × 365 | 394 million a year |
| Tracking storage | 394 million × 0.4 KB | 158 GB a year |
| Weight of tracking | 2.88 million out of 4.06 million requests a day | 71% of Central's traffic |
| Communication paths among 45 people | 45 × 44 / 2 | 990 |
| Communication paths among 6 teams | 6 × 5 / 2 | 15 |
Two figures decide the case. Tracking is 71% of the traffic, and at the peak hour of the campaign it multiplies its average by 10, while shipment registrations barely triple. And 45 people changing the same code have 990 ways of getting in each other's way. The second figure does not measure machines, and it is the one that weighs most.
Why Rutalia Yes, and Verdalia No
The review conditions of ADR-001 and the criteria of the lesson “Microservices vs. Monoliths” give opposite answers at the two companies:
| Condition or criterion | Verdalia | Rutalia |
|---|---|---|
| More than 8 people, or several teams | 3 people | 45, in 6 teams |
| An area with very different capacity needs | No: the whole store is scaled | Tracking, 71% of the traffic |
| Volume | 2,600 orders a month | 3.6 million shipments a month |
| Different rates of change | Only notifications | Rates change every week. Billing, every quarter |
| Failure isolation needed | Only notifications | Tracking stopped the deliveries |
| Operational maturity | Three people who do everything | A platform team of 6 people |
Verdalia already did a migration in miniature. When it extracted the notification-service, in ADR-003, it followed the same steps without knowing it: it chose the least coupled piece, put it behind an interface, the Notifier port, and kept the old adapter so it could roll back. Rutalia does the same, at another scale and many times over.
Step 4: High-Level Design, With the Strangler Fig Pattern
Rutalia had already tried the alternative. In 2024 it started rewriting Central from scratch. The project was canceled after 11 months, without a single function in production: while it was being rewritten, Central kept changing, and the new system was chasing a moving target. That is the all-at-once migration, or big bang.
The Strangler Fig pattern takes its name from a tropical fig tree that grows around a tree, wraps it little by little, and ends up taking its place. Martin Fowler described it. It has three moves, which are repeated with every piece:
- Intercept. A facade is placed in front of the old system. At first it lets everything through.
- Divert. The new piece is built, and the facade sends it a growing share of the traffic.
- Remove. When the new piece handles 100%, the old code is deleted.
The facade is an API gateway, the component Verdalia discarded in Module 3 for having a single internal service. Here it is the central piece.
Before
flowchart TB
users(["Stores, recipients, and couriers"])
subgraph central["Central: one application, 45 people"]
intake["Intake"]
routing["Routing"]
tracking["Tracking"]
billing["Billing"]
customers["Customers"]
end
db[("One database: 310 tables")]
users --> central
central --> db
During
flowchart TB
users(["Stores, recipients, and couriers"])
facade["Facade: API gateway, with a routing table"]
subgraph central["Central"]
rest["Intake, Routing, Billing, and Customers"]
old["Old tracking, being phased out"]
end
db[("Central's database")]
cdc["Change data capture"]
subgraph new_svc["tracking-service"]
acl["Anti-corruption layer"]
tracking["Tracking"]
trackdb[("Own database")]
end
users --> facade
facade -->|"10% of /tracking"| tracking
facade -->|"Everything else"| central
central --> db
db --> cdc --> acl --> tracking --> trackdb
After
flowchart TB
users(["Stores, recipients, and couriers"])
facade["API gateway"]
intake["intake-service"]
routing["routing-service"]
tracking["tracking-service"]
rates["rates-service"]
alerts["alerts-service"]
central["Central, reduced: customers, billing, and administration"]
bus["Event bus"]
users --> facade
facade --> intake
facade --> tracking
facade --> rates
facade --> central
intake --> routing
intake --> bus
routing --> bus
bus --> tracking
bus --> alerts
bus --> central
The third diagram is the target state, planned for 2028. Each service has its own database, which has been left out. And Central does not disappear. A smaller monolith, with the areas that change little, is a valid ending.
Boundaries and Extraction Order
Bounded Contexts
To decide where to cut, Rutalia used an idea from domain-driven design, or DDD: the bounded context. It is a part of the business within which each word has a single meaning. The sign that there is a boundary is that the same word changes its meaning:
| Context | What a “shipment” is | What it cares about |
|---|---|---|
| Intake | An order from a store | Sender, recipient, weight, and rate |
| Routing | A parcel that takes up room in a van | Volume, postal code, and time slot |
| Tracking | A sequence of scans of a label | Where and when it was scanned |
| Billing | A line on an invoice | Amount, customer, and period |
In Central, the four ideas shared a shipments table with 94 columns. Each team used about twenty, and was afraid to touch the rest. One service per context, with its own model of “shipment,” is a boundary that follows the business. It is the opposite of splitting by technical layers.
What Gets Extracted First
| Candidate | Value | Risk | Coupling | Decision |
|---|---|---|---|---|
| Tracking | Very high: 71% of the traffic, and the worst incident | Low: almost everything is reads | Low: it receives data, and nobody waits for its answer to work | First |
| Rates | High: changes every week | Medium: a mistake overcharges or undercharges | Medium | Second |
| Recipient alerts | Medium | Low | Low | Third |
| Intake | High | High: it is the entry point of the business | High: it writes to three contexts | Fourth, with experience |
| Billing | Medium | Very high: money and legal obligations | Very high | Last, or never |
The rule is to start where value is high and risk and coupling are low. The first service must go well, because it is how you learn to migrate. Starting with the hardest piece “to get it out of the way” is the fastest way to lose support.
Step 5: Data Model and Choice of Data Stores
Extracting the code is the easy half. The hard one is the shared database. As long as two services read the same tables, they are not independent: a column change in one breaks the other. The rule is the one from Module 3, taken to the extreme: one database per service, which nobody else accesses.
| Stage | What happens | Who owns the data |
|---|---|---|
| 1. Single owner | In Central, only the tracking code touches the tracking tables. The others call it | Central |
| 2. Copy and synchronization | The new service has its database, fed continuously from Central's | Central |
| 3. Reads | The facade diverts reads to the new service, by percentages | Central |
| 4. Writes | The new service starts writing. The synchronization is reversed, or switched off | The new service |
| 5. Removal | The old tables are deleted from Central, after a grace period | The new service |
For stage 2 there are three techniques:
| Technique | How it works | Drawback |
|---|---|---|
| Dual write | The application writes to both databases | If the second write fails, they diverge, and nobody knows. Not recommended |
| Batch copy | A process copies the changes every so often | A delay of minutes or hours |
| Change data capture, or CDC | A tool reads the database's transaction log and publishes each change as an event | One more piece to operate |
Change data capture relies on the same log that feeds the replicas, the one we saw in Module 4. It does not require touching Central's code, and it loses no changes. Rutalia chose it. Its delay, of 1 to 3 seconds, is acceptable for tracking.
The stores change too. Tracking receives 394 million rows a year, which are only appended and queried by shipment code. Its database is partitioned by date, something nobody dared to do in the shared table.
Step 6: Detailed Design of the Critical Points
The Strangler Facade
import hashlib
from collections import Counter
MONOLITH = "monolith"
def bucket(key):
"""A number from 0 to 99, always the same for the same key."""
digest = hashlib.sha256(key.encode("utf-8")).hexdigest()
return int(digest, 16) % 100
class StranglerFacade:
def __init__(self, routes):
self.routes = routes # prefix -> new service and percentage
self.down = set() # services that fail their health check
def target(self, route, key):
for prefix, rule in self.routes.items():
if route.startswith(prefix):
if rule["service"] in self.down:
return MONOLITH # automatic rollback
if bucket(key) < rule["percentage"]:
return rule["service"]
return MONOLITH
return MONOLITH # whatever has not been migrated
facade = StranglerFacade({
"/tracking": {"service": "tracking-service", "percentage": 0},
"/rates": {"service": "rates-service", "percentage": 100},
})
shipments = [f"RUT-{number:07}" for number in range(1, 10_001)]
previous = set()
for percentage in (1, 10, 50, 100):
facade.routes["/tracking"]["percentage"] = percentage
targets = Counter(facade.target(f"/tracking/{shipment}", shipment) for shipment in shipments)
migrated = {s for s in shipments if facade.target(f"/tracking/{s}", s) != MONOLITH}
print(f"{percentage:3}% new service: {targets['tracking-service']:5} "
f"monolith: {targets[MONOLITH]:5} keep their target: {previous <= migrated}")
previous = migrated
facade.routes["/tracking"]["percentage"] = 10
for route, key in (("/tracking/RUT-0000029", "RUT-0000029"),
("/tracking/RUT-0000042", "RUT-0000042"),
("/rates/calculate", "customer-verdalia"),
("/invoices/2027-09", "customer-verdalia")):
print(f"{route:26} -> {facade.target(route, key)}")
facade.down.add("tracking-service")
print("With the service down: ->", facade.target("/tracking/RUT-0000029", "RUT-0000029"))Output:
1% new service: 110 monolith: 9890 keep their target: True 10% new service: 1034 monolith: 8966 keep their target: True 50% new service: 4965 monolith: 5035 keep their target: True 100% new service: 10000 monolith: 0 keep their target: True /tracking/RUT-0000029 -> tracking-service /tracking/RUT-0000042 -> monolith /rates/calculate -> rates-service /invoices/2027-09 -> monolith With the service down: -> monolith
Explanation:
bucketturns a key into a number from 0 to 99, with the hashing technique from Module 4. The split is not done at random, because the same shipment would jump from one system to the other on every query. With the hash, shipmentRUT-0000029always goes to the same place.targetwalks the routing table. If the prefix matches, it compares the bucket with the percentage. Everything that is not in the table goes to the monolith: that is the safe default behavior.previous <= migratedchecks that one set is contained in another. Whoever was already using the new service at 1% keeps using it at 10%. Raising the percentage only adds shipments.downis the rollback. If the new service fails, the facade returns its traffic to the monolith, which keeps the function until the removal stage. Scenario RS-3 asked for 5 minutes, and this takes seconds.- The real split is not exact: 1,034 shipments, not 1,000. It only needs to be stable.
Raising the percentage means changing a number in the configuration, without deploying anything. It is the same idea as Verdalia's feature flags, applied to traffic.
The Anti-Corruption Layer
The new service must not inherit the 94 columns of shipments, nor its one-letter status codes. The anti-corruption layer is a translator placed at the boundary: it converts the old model into the new one, and it is the only code that knows both. It is an adapter, in the sense of Module 2, between two systems instead of between two modules. When Central drops out of that conversation, the layer is deleted, and the service does not change.
Transactions That Cross Services: The Saga
In Central, registering a shipment was a transaction: the shipment was created, the slot on the route was reserved, and the charge was made, all or nothing. With three services and three databases, that transaction no longer exists. It is replaced by a saga: a sequence of local transactions, one per service, in which each step has a compensation that undoes its effect.
| Variant | Who directs | Advantage | Drawback |
|---|---|---|---|
| Choreography | Nobody. Each service reacts to the others' events | No central piece. Low coupling | The process is not written down anywhere |
| Orchestration | An orchestrator calls each service, in order | The process can be read in a single place | The orchestrator knows everyone |
These are the two ways of directing a process that we saw in Module 3. Rutalia uses orchestration for shipment registration, which has a strict order, and choreography for what happens afterward, such as the alerts.
class StepFailed(Exception):
"""A step of the saga could not be completed."""
class Intake:
def __init__(self):
self.shipments = {}
def create_shipment(self, saga):
self.shipments[saga["id"]] = "created"
def cancel_shipment(self, saga):
self.shipments[saga["id"]] = "canceled" # not deleted: a record is kept
class Routing:
def __init__(self, slots):
self.slots = dict(slots) # route -> packages that still fit
def reserve_route(self, saga):
if self.slots[saga["route"]] == 0:
raise StepFailed(f"route {saga['route']} is full")
self.slots[saga["route"]] -= 1
def release_route(self, saga):
self.slots[saga["route"]] += 1
class Billing:
def __init__(self, credit):
self.credit = dict(credit) # customer -> available credit, in euros
def charge(self, saga):
if self.credit[saga["customer"]] < saga["amount"]:
raise StepFailed(f"insufficient credit for {saga['customer']}")
self.credit[saga["customer"]] -= saga["amount"]
def refund(self, saga):
self.credit[saga["customer"]] += saga["amount"]
class SagaOrchestrator:
"""Runs the steps in order. If one fails, compensates the previous ones in reverse order."""
def __init__(self, steps):
self._steps = steps # list of (name, action, compensation)
def run(self, saga):
completed = []
for name, action, compensation in self._steps:
try:
action(saga)
except StepFailed as error:
print(f" {name}: FAILED, {error}")
for done_name, compensate in reversed(completed):
compensate(saga)
print(f" compensated: {done_name}")
return "compensated"
print(f" {name}: done")
completed.append((name, compensation))
return "completed"
intake = Intake()
routing = Routing({"ZGZ-VLC-07": 1, "ZGZ-BCN-02": 0})
billing = Billing({"verdalia": 50.0, "vivero-sur": 3.0})
orchestrator = SagaOrchestrator([
("create shipment", intake.create_shipment, intake.cancel_shipment),
("reserve route", routing.reserve_route, routing.release_route),
("charge", billing.charge, billing.refund),
])
SAGAS = [
{"id": "RUT-0000101", "customer": "vivero-sur", "route": "ZGZ-VLC-07", "amount": 6.40},
{"id": "RUT-0000102", "customer": "verdalia", "route": "ZGZ-VLC-07", "amount": 6.40},
{"id": "RUT-0000103", "customer": "verdalia", "route": "ZGZ-BCN-02", "amount": 7.10},
]
for saga in SAGAS:
print(saga["id"])
print(" result:", orchestrator.run(saga))
print("Shipments:", intake.shipments)
print("Slots:", routing.slots)
print("Credit:", billing.credit)Output:
RUT-0000101
create shipment: done
reserve route: done
charge: FAILED, insufficient credit for vivero-sur
compensated: reserve route
compensated: create shipment
result: compensated
RUT-0000102
create shipment: done
reserve route: done
charge: done
result: completed
RUT-0000103
create shipment: done
reserve route: FAILED, route ZGZ-BCN-02 is full
compensated: create shipment
result: compensated
Shipments: {'RUT-0000101': 'canceled', 'RUT-0000102': 'created', 'RUT-0000103': 'canceled'}
Slots: {'ZGZ-VLC-07': 0, 'ZGZ-BCN-02': 0}
Credit: {'verdalia': 43.6, 'vivero-sur': 3.0}Explanation:
- The three classes represent three services, each with its own data. In production, each method is a network call, with its timeout and its idempotency key.
SagaOrchestratorreceives the steps as triples: name, action, and compensation. It records the finished steps incompleted. If one raisesStepFailed, it walks that list backwards, withreversed, and runs each compensation.- Shipment
RUT-0000101reserved the last slot on the Valencia route, and gave it back when the charge failed. Thanks to that,RUT-0000102found room. - A compensation is not a deletion. The canceled shipment still exists, with another status. Between the first step and the compensation, others may have seen that shipment: a saga does not isolate, and that is its difference from a transaction.
- It is the same mechanism as Verdalia's stock reservation in the previous lesson, which was a two-step saga with a single compensation.
A real orchestrator stores the state of each saga in its database, so it can continue if it restarts halfway through. And it retries the compensations, which can fail too.
The Outbox Pattern
When creating a shipment, the intake service must do two things: save it in its database and publish the shipment.created event. If it saves and crashes before publishing, tracking will never know about the shipment. It is the dual-write problem, in another disguise. The Outbox pattern solves it like this: in the same local transaction, the shipment and a row in the outbox table are saved. A separate process reads that table and publishes the events. The event may be published twice, but never zero times. That is why consumers must be idempotent, like Verdalia's worker.
Parallel Run and Dark Launch
| Technique | What it does | What for |
|---|---|---|
| Dark launch | The new service receives a copy of the real traffic. Its response is discarded | Checking that it withstands the load |
| Parallel run | The responses of the new service and the monolith are compared. The user receives the monolith's | Checking that it answers the same |
For three weeks, in July 2026, Rutalia compared every tracking query. 0.8% differed. There were two causes: times in a different time zone, and scans that arrived out of order. No test had found them. Only read traffic is safe to duplicate: duplicating writes would charge twice.
Step 7: Bottlenecks, Failures, and Trade-offs
| Risk | How it is recognized | Rutalia's defense |
|---|---|---|
| Distributed monolith | Services that share tables, or that are deployed together | One database per service. Contract tests between services |
| Migration that never ends | Two systems to maintain for years. The monolith keeps growing | 25% of capacity, reserved. Central accepts no new functions from a context already extracted |
| All-at-once migration | Months of work with nothing in production | Strangler Fig pattern. Each service reaches production by percentages |
| Migrating blind | A failure nobody can locate | Platform and observability, before the first service |
There are two more requirements, which are not about code. The first is the platform. With six services, each request crosses several, and without distributed traces you cannot tell where the time goes. Verdalia could postpone them with two deployable pieces, but Rutalia cannot. It also needs a delivery pipeline per service, and a common way to deploy. That is why phase 0 extracted nothing.
The second is the organization. Conway's law says that a system ends up reproducing the communication structure of whoever builds it. Six teams sharing a monolith produce a tangled monolith. Rutalia reorganized its teams by bounded context, one per service, before extracting them. A service without an owning team ends up belonging to nobody.
The accepted trade-offs: the infrastructure costs 40% more, tracking shows data with up to 3 seconds of delay, operations that cross services are harder to debug, and for three years two ways of doing things coexist.
Step 8: Evolution and Recorded Decisions
| Phase | Dates | Content | Milestone |
|---|---|---|---|
| 0. Platform | January to April 2026 | Pipeline, traces, and the facade in front of Central | April 14: the facade in production, with 100% toward Central |
| 1. Tracking | May to October 2026 | Change data capture, parallel run, and diversion by percentages | October 20: 100% of the queries. 2026 campaign, without incidents |
| 2. Rates | November 2026 to March 2027 | First service with writes | March 23, two months late |
| 3. Alerts and intake | April to September 2027 | Shipment registration saga and outbox | September 28: intake, at 100% |
| 4. To be decided | 2028 | Routing or the customer portal. It is the first exercise of the lesson | Pending |
What went wrong:
- A shortcut in the data. To save time, the rates service was born reading Central's tables. On February 9, 2027, a column change in Central left it out of action for 3 hours and 40 minutes. Nobody could calculate a price. It was a distributed monolith, brand new. The fix, its own database and an anti-corruption layer, cost the two months of delay.
- A stall. After the success of tracking, management considered the problem solved, and between November and January almost no progress was made. That is where the 25% rule came from.
- An orchestrator that restarted. In June 2027, 212 sagas were left half done after a deployment, with slots reserved and not charged. Since then, the state of each saga is stored, and a reconciliation process reviews every hour the ones that have been open for more than 10 minutes.
The delivery metrics, the four DORA metrics you met in Module 6:
| Metric | Central, in 2025 | Extracted services, September 2027 | Central, September 2027 |
|---|---|---|---|
| Deployment frequency | 2 a month | 61 a month, across the four | 4 a month |
| Lead time | 34 days | 1.5 days | 16 days |
| Deployments with an incident | 38% | 7% | 22% |
| Time to recover | 5 h 20 min | 18 minutes | 2 h 10 min |
Scenarios RS-1 and RS-4 are met in the extracted services. Central has improved too, because it is smaller: it has lost 330,000 lines, and 78% of the traffic no longer passes through it. Each extraction was recorded in an ADR, with its rollback condition. Billing has no date. Germán summed it up like this: “We did not migrate to have microservices. We migrated to be able to deploy on a Tuesday.”
Common Mistakes and Tips
- Rewriting from scratch. The old system does not stop to wait.
- Extracting the code and leaving the data. Two services on the same tables are a monolith with a network in the middle.
- Writing to two databases from the application. Sooner or later, one of the two writes fails.
- Starting with the hardest piece. The first extraction teaches you how to migrate, and it must be able to go well.
- Migrating and adding functions at the same time. When something fails, you will not know why.
- Forgetting the removal. A new service with the old code still alive doubles the maintenance.
- Designing compensations that cannot fail. They can. They are retried, and whatever is left gets reconciled.
- Practical tip. Set the metric before you start. If after the first service it has not improved, stop and find out why.
Exercises
Exercise 1: What Would You Extract Next?
After phase 3, Rutalia is torn between three candidates. Rate each one from 1 to 5 on value, risk, and coupling, and propose an order.
- Routing. Its planning algorithm consumes a lot of processor from 5:00 a.m. to 7:00 a.m. It changes every month. Intake calls it on every registration.
- Billing. It changes every quarter. It reads data from every context. A mistake has legal consequences.
- Customer portal. It changes every week, mostly in its appearance. It reads from every context, and writes to none.
Exercise 2: A Saga for Returns
A store asks to return a shipment that has already been delivered. The steps are: create the return order, reserve a pickup on a route, credit the amount to the store, and pick up the package at the home. Give the compensation for each step, point out which one cannot be compensated, and decide the order.
Solutions
Solution to Exercise 1
| Candidate | Value | Risk | Coupling | Comment |
|---|---|---|---|---|
| Routing | 5 | 3 | 3 | It needs different capacity, at a different time. The intake saga already treats it as a service |
| Customer portal | 4 | 1 | 2 | It only reads. It can query the others' APIs |
| Billing | 2 | 5 | 5 | It changes little, and touching it is dangerous |
A reasonable order is: portal, routing, and, perhaps never, billing. The portal goes first because its risk is minimal and it frees up the team that deploys the most. Routing has more value, but its planning deserves an unhurried extraction. Starting with routing is also defensible, if the 5:00 a.m. capacity is the most urgent problem. What is not defensible is starting with billing. Common mistake: rating only the value.
Solution to Exercise 2
| Step | Compensation |
|---|---|
| Create the return order | Cancel the order |
| Reserve the pickup | Release the slot |
| Pick up the package | None. A package that has been picked up cannot be “un-picked-up” |
| Credit the amount | Charge the amount again: possible, but poorly received |
The correct order is not the one in the statement: create, reserve, pick up, and, at the end, credit. The step that cannot be compensated is placed after all the ones that can fail for business reasons, and the credit comes after having the package. If the pickup fails, because nobody is home, the first two steps are compensated and nobody has received money. From the pickup onward, the saga can only move forward: the credit is retried until it completes. That step with no way back is called the pivot.
Conclusion
In this lesson you have applied the eight-step method to a migration. You have seen that the Strangler Fig pattern replaces a system piece by piece, with a facade that diverts traffic by percentages and allows rolling back in seconds. You have learned to look for boundaries in bounded contexts, and to order extractions by value, risk, and coupling. You have confirmed that the hard part is the data: one database per service, change data capture instead of dual writes, and sagas with compensations where there used to be a transaction. And you have seen that a migration is also a change of organization, which requires a platform beforehand and teams that own their services.
Rutalia has extracted four services in 21 months, has gone from 2 deployments a month to 61, and has stumbled three times. Verdalia needs none of this, and the case confirms it: it meets none of the three review conditions of its ADR-001.
The two companies have something in common. In both, every write is money, and consistency outweighs everything else. At the same table at the meetup sits Aitana, head of platform at Brotes, a social network for plant lovers with eight million users. Her system follows other rules: there are a hundred reads for every write, a “like” can arrive late without anyone losing anything, and a single photograph can multiply the traffic within an hour. We will study it in the next lesson: “Case Study: Architecture of a Social Network Application.”
