design by size · lesson 6 of 8 · sources checked 2026-11-30
move a component to the next tier
This lesson moves one component to the next tier in reversible steps, with a decision record and a comparison report.
status of this lesson: from a public sourcepurpose
A move to a larger tier changes a part that works now. A move in one step can stop the system, and you can lose data with no way back. Small steps with a check at each step keep each step reversible.
objectives
- List the five steps of a move to the next tier.
- Write a decision record with all consequences of the move.
- Feed the old part and the new part from one source with no second fetch on a target.
- Write a comparison report, and decide if the first traffic step can start.
new terms
- shadow on the fetch
- A shadow comparison in which each version makes its own request to the target.
- comparison report
- A report that compares the output of an old part and a new part on the same inputs before a move of traffic.
how it works
A move of one component to the next tier has five steps:
- Write a decision record.
- Put the new part beside the old part.
- Feed both parts from one source.
- Compare the outputs in a report.
- Move the traffic in steps, and then remove the old part.
the decision record
The decision record gives the context, the decision, the status, and the consequences of the move. The consequences include what the team gives up. For example, a move from a table of jobs to a log with partitions gives a higher rate. The team gives up the transaction that writes a job and its data in one step.
The record also names the sign metric that started the move, and the value at which the team stops the move.
the new part beside the old part
claim of a publisher In 2024, Martin Fowler called this form of move a strangler fig application. His article stated these points Martin Fowler, source 1:
- The move starts with small additions, often new features.
- The replacement of a serious system takes a long time, and the users cannot wait for new features.
- The move uses a transitional architecture, so that the new system and the legacy system can coexist.
- That architecture is code that goes away when the move is complete.
one source for both parts
Both parts must get the same inputs. One method is an outbox. The old part writes each change in the same transaction as its data. A relay then gives each change to both parts. The outbox is in The job ledger, the outbox, and settlement (not yet published).
A collector has one more rule: the move never doubles the fetches on a target. Thus the politeness rules of the site hold during the move.
For example, a shadow on the response lets one fetch feed both parts. A shadow on the fetch makes a second request for each page, and thus it doubles the load.
The other method is a set of recorded inputs. Both parts read the same stored responses, and no part sends a request.
the comparison report
A comparison report compares the outputs of the two parts on the same inputs. It compares three things:
- The count of output records.
- The keys: each key that is only in one output, and each key with a different count.
- The order that the contract of the component gives, for example the order in each host.
For example, the old part drops a repeated key, and the new part does not. The counts then differ by one, and the report shows the key. The code example shows this case.
traffic steps with a rollback
The traffic moves in steps, for example 10% and then 100% of the work. Each step has a written rollback: the condition and the action that send the traffic back to the old part. The next step starts only when the report of the step before passes.
removal of the old part
The move ends with the removal of the old part: its code, its tables, and its alarms. For example, a table of jobs that nobody reads still has a backup and an alarm. A move with no removal keeps two parts that the team must operate.
the two sides
| automation side | detection side |
|---|---|
| A move beside the old part must not double the requests to a target. Compare on recorded inputs, or let one fetch feed both parts. | A defender moves a detection component in the same way. It runs the new scorer in shadow mode before it acts on traffic. The steps are in Release a rule in count mode (not yet published). |
design decisions
| option | gain | cost | when it is correct |
|---|---|---|---|
| Move in one step | The work is short. | No way back, and no comparison | Never for a part that holds data |
| New part beside the old part | Each step is reversible. | Two parts to operate during the move | For each move of a part with data |
| One source through an outbox | Both parts get the same changes. | A relay and a table to operate | When the old part writes to a database |
| Recorded inputs | No request to a target | The inputs can be old. | For each part that reads fetched pages |
| One fetch that feeds both parts | Live inputs with one request | The new part must keep the pace of the old part. | When recorded inputs are not sufficient |
| Traffic steps with a rollback | A fault touches a small part of the work. | More time for the move | For each move |
diagram
a move to the next tier with one source, a comparison, and traffic steps
code example
The example gives the same eight synthetic jobs to an old part and to a new part. Then it compares the counts, the keys, and the order in each host. The host names are reserved example names.
Feed the old tier and the new tier with the same recorded inputs, and compare counts, keys, and order.
// Comparison report for a move: the old tier and the new tier get the same recorded inputs.
// The inputs are synthetic. No part of this code sends a request.
type Job = { key: string; host: string };
const recorded: Job[] = [
{ key: "a1", host: "shop.example" }, { key: "b1", host: "news.example" },
{ key: "a2", host: "shop.example" }, { key: "a2", host: "shop.example" },
{ key: "b2", host: "news.example" }, { key: "c1", host: "docs.example" },
{ key: "a3", host: "shop.example" }, { key: "c2", host: "docs.example" },
];
// Old tier: one table queue. It drops a repeated key and keeps the global order.
function oldTier(jobs: Job[]): Job[] {
const seen = new Set<string>();
return jobs.filter((j) => (seen.has(j.key) ? false : (seen.add(j.key), true)));
}
// New tier: a log with two partitions by host. It keeps the order in each host only.
// It has no step that drops a repeated key: the report must find that.
function newTier(jobs: Job[]): Job[] {
const part = (h: string) => [...h].reduce((s, c) => s + c.charCodeAt(0), 0) % 2;
return [0, 1].flatMap((p) => jobs.filter((j) => part(j.host) === p));
}
const byHost = (jobs: Job[]) => {
const m = new Map<string, string[]>();
for (const j of jobs) m.set(j.host, [...(m.get(j.host) ?? []), j.key]);
return m;
};
const count = (jobs: Job[]) => {
const m = new Map<string, number>();
for (const j of jobs) m.set(j.key, (m.get(j.key) ?? 0) + 1);
return m;
};
const oldOut = oldTier(recorded);
const newOut = newTier(recorded);
const oc = count(oldOut), nc = count(newOut);
const missing = [...oc.keys()].filter((k) => !nc.has(k));
const extra = [...nc.keys()].filter((k) => !oc.has(k));
const repeated = [...nc].filter(([k, n]) => n !== (oc.get(k) ?? 0)).map(([k]) => k);
const ob = byHost(oldOut), nb = byHost(newOut);
const hostOrder = [...ob.keys()].map((h) => {
const o = ob.get(h)!, n = (nb.get(h) ?? []).filter((k, i, a) => a.indexOf(k) === i);
return `${h}: ${o.join() === n.join() ? "same" : "different"}`;
});
const globalSame = oldOut.map((j) => j.key).join() === newOut.map((j) => j.key).join();
console.log(`recorded inputs: ${recorded.length}`);
console.log(`count: old ${oldOut.length}, new ${newOut.length}`);
console.log(`keys missing in new: ${missing.length ? missing.join(", ") : "none"}`);
console.log(`keys only in new: ${extra.length ? extra.join(", ") : "none"}`);
console.log(`keys with a different count: ${repeated.length ? repeated.join(", ") : "none"}`);
console.log(`order in each host: ${hostOrder.join("; ")}`);
console.log(`global order: ${globalSame ? "same" : "different (not part of the contract)"}`);
const pass = missing.length === 0 && extra.length === 0 && repeated.length === 0
&& hostOrder.every((s) => s.endsWith("same"));
console.log(`result: ${pass ? "pass, move the first traffic step" : "fail, no traffic step"}`);output
The counts of the two parts, the keys that differ, the order in each host, and the result of the report.
recorded inputs: 8
count: old 7, new 8
keys missing in new: none
keys only in new: none
keys with a different count: a2
order in each host: shop.example: same; news.example: same; docs.example: same
global order: different (not part of the contract)
result: fail, no traffic stepThe output shows that the new part keeps the repeated key a2. The order in each host is the same, but the counts differ. Thus no traffic step starts until the new part drops the repeated key.
failure modes
| problem | cause | correction |
|---|---|---|
| A target gets two requests for each page during the move. | Each part makes its own fetch. | Use recorded inputs, or let one fetch feed both parts. |
| The new part loses records that the old part keeps. | Nobody compared the outputs before the first traffic step. | Write a comparison report, and start a step only after it passes. |
| The two parts get different inputs. | Each part reads its own copy of the source. | Feed both parts from one source through an outbox. |
| A fault in a traffic step has no way back. | The step has no written rollback. | Write the condition and the action of the rollback for each step. |
| The team operates two parts after the move. | The old part was never removed. | Remove the code, the tables, and the alarms of the old part. |
| A later team does not know why the tier changed. | The move has no decision record. | Write the record with all consequences before the move. |
check questions
List the five steps of a move of one component to the next tier.
sample answer
Write a decision record. Put the new part beside the old part. Feed both parts from one source. Compare the outputs in a comparison report. Move the traffic in steps with a rollback, and then remove the old part.
Which item must a decision record of a move give?
- Only the new tier and its name
- The consequences of the move, with what the team gives up
- The list of traffic steps only
answer
b. The consequences of the move, with what the team gives up
A decision record gives the context, the decision, the status, and the consequences. The consequences include what the team gives up.
A collector moves its extractor to a new tier. Which method feeds both parts and keeps the load on the target the same?
- Each part makes its own fetch of each page.
- The new part fetches each page one hour after the old part.
- Both parts read the same recorded responses.
answer
c. Both parts read the same recorded responses.
Recorded inputs, or one fetch that feeds both parts, send no second request. A second fetch for each page doubles the load on the target.
A comparison report shows the same keys and the same order in each host, but the new part has one record more. What do you do?
- Start no traffic step, and find the record that the new part repeats.
- Start the traffic step of 100%, because the keys agree.
- Remove the old part, because the order agrees.
answer
a. Start no traffic step, and find the record that the new part repeats.
A traffic step starts only when the counts, the keys, and the order all agree. A different count shows a key that one part repeats or drops.
exercise
exercise Do this task on paper. A team moves a queue of fetch jobs from a table to a log with partitions. Use the synthetic comparison report below.
The synthetic comparison report:
- Recorded inputs: 2,000 jobs.
- Count: old part 1,990, new part 1,990.
- Keys missing in the new part: none.
- Keys only in the new part: none.
- Order in each host: different for one host.
- The contract of the component: the order in each host must stay the same.
- Write the five steps of the move for this queue.
- Write two consequences of the move for the decision record.
- Write if the first traffic step can start.
- Write the correction that the report asks for.
sample answer
The answer uses the synthetic report of the task.
The five steps are a decision record, the new log beside the old table, and one source for both. Then come a comparison report, and traffic steps with a rollback and the removal of the table.
Two consequences: the team gets a higher rate, and the team gives up the transaction that writes a job and its data in one step.
The counts and the keys agree, but the order in one host differs. The contract asks for the same order in each host. Thus the first traffic step does not start.
The correction is to put all jobs of one host in one partition. Then the team runs the report again.
sources
- Strangler Fig Application, Martin Fowler, article, read 2026-11-22
- My model of the five steps of a move to the next tier and of the comparison report, 2026-11 (not public).