12345678
12345678
ABCD
ABCD
MOSSWELL ARCHITECTURE REVIEW · RFC 042
Moving courier dispatch from the monolith to an event-driven core
Drawn by {{author}}
SHEET
{{#}} / {{total}}
REVISION
A
A
DRAWING INDEX
01
Load, latency and the four hops
02
Events, consumers and contracts
03
Three designs and why one won
04
Four phases, each one reversible
SECTION
R 360
Each hop is a synchronous call, so one slow service stalls the whole queue.
1120
Order volume has tripled in the past twelve months, and dispatch is still one process that matches couriers, prices the job and sends the notification, one step after another.
At the evening peak the queue backs up for minutes at a time, and every fix so far has meant scaling the whole monolith rather than the one part under load.
SHEET {{#}} / {{total}}
ORDERS PER MINUTE
P99 MATCH, MS
SYNCHRONOUS HOPS
Source: Mosswell platform metrics, last quarter
Validates and writes order.placed
01
Durable, ordered and replayable
02
Picks a courier in under 50 ms
03
Pushes the job to the courier app
04
All four stages publish to the same log, so any one can be replayed on its own.
GENERAL NOTES
SHEET {{#}}
Every consumer reads the same versioned event. Fields are only ever added, never renamed.
event: order.placed
version: 2
key: order_id
fields:
order_id: string
pickup: { lat: float, lng: float }
dropoff: { lat: float, lng: float }
ready_at: timestampFIG. 2 · EVENT SCHEMA, VERSION 2
OPTION A
Decoupled and replayable. Each team scales its own consumer.
OPTION B
Fastest to ship, but every peak still scales everything.
OPTION C
Cleaner boundaries, the same synchronous chain underneath.
WEEKS 1–2
Publish events next to the old calls
WEEKS 3–4
The matcher reads events, the monolith decides
WEEKS 5–6
The matcher decides, one city at a time
WEEK 7 ON
Remove the synchronous calls
FIG. 3
Jobs arrive as soon as the matcher commits. Couriers see pickup, drop-off and ready time on one card.
600
John Gall
Systemantics
FOR REVIEW
#dispatch-v2 · rfc-042@mosswell.example
SHEET
{{#}} / {{total}}
STATUS
END