12345678

12345678

ABCD

ABCD

MOSSWELL ARCHITECTURE REVIEW · RFC 042

Blueprint

Moving courier dispatch from the monolith to an event-driven core

Drawn by {{author}}

SHEET
{{#}} / {{total}}

REVISION
A

A

DRAWING INDEX

On this sheet

01

Where dispatch hurts

Load, latency and the four hops

02

The proposed core

Events, consumers and contracts

03

Options we weighed

Three designs and why one won

04

Rollout and risks

Four phases, each one reversible

01

SECTION

Where dispatch hurts today

R 360

Every order crosses the monolith four times before a courier moves.

Each hop is a synchronous call, so one slow service stalls the whole queue.

Why now

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}}

Measured at the evening peak

ORDERS PER MINUTE

2.4K

P99 MATCH, MS

380

SYNCHRONOUS HOPS

4

Source: Mosswell platform metrics, last quarter

The proposed request path

Order API

Validates and writes order.placed

01

Event log

Durable, ordered and replayable

02

Matcher

Picks a courier in under 50 ms

03

Notifier

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.

What changes for teams

GENERAL NOTES

SHEET {{#}}

  • Services publish events instead of calling dispatch directly
  • Each consumer owns its own read model
  • Schema changes go through the contract registry
  • On-call moves from one team to three

The order.placed contract

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: timestamp

FIG. 2 · EVENT SCHEMA, VERSION 2

Options we weighed

OPTION A

Event log

Decoupled and replayable. Each team scales its own consumer.

OPTION B

Bigger monolith

Fastest to ship, but every peak still scales everything.

OPTION C

Service mesh

Cleaner boundaries, the same synchronous chain underneath.

Rollout plan

WEEKS 1–2

Shadow mode

Publish events next to the old calls

WEEKS 3–4

Read path

The matcher reads events, the monolith decides

WEEKS 5–6

Cutover

The matcher decides, one city at a time

WEEK 7 ON

Retire

Remove the synchronous calls

FIG. 3

Courier app, dispatch view

Jobs arrive as soon as the matcher commits. Couriers see pickup, drop-off and ready time on one card.

600

“

A complex system that works is invariably found to have evolved from a simple system that worked.

John Gall
Systemantics

FOR REVIEW

Open for comments

#dispatch-v2 · rfc-042@mosswell.example

SHEET
{{#}} / {{total}}

STATUS
END