System Design Atlas

Multimodal journey planning

05 / 10Worked example

Data and states

Generations prevent mixed timetable versions. Which conditions ensure a valid result?

A new import reaches the platform during ongoing searches.

Starting point queryKey binds the input and completed response version.

Assumptions for the example case

A fictional journey planner for buses, trains and walking routes in one region. Each response binds a timetable version and a real-time snapshot. The scope ends with journey information, without a booking commitment. All quantities, thresholds and operational objectives are illustrative assumptions.

Pinned generation

bound graph generation

Active pointerGeneration 7
Q-41Graph 7 + rt-7
Import 8unchangeable graph
Next requestGraph 8 + rt-8
Aktiver Zeiger → Q-41Snapshot at Start
Import 8 → Aktiver ZeigerActivating atomically
Aktiver Zeiger → Nächste AnfrageNew Snapshot

A running request reads exactly one graph generation and its real-time snapshot; activation affects only new requests.

The active pointer changes from generation 7 to 8. The running request remains on 7; a new request uses 8. Each generation has its own real-time snapshot.

State transitions and completion

Starting pointCondition and effectSubsequent state
StartedSearch space fully explored and at least one valid connection fully assessedResult
StartedSearch space fully checked without permissible pathNo route
StartedBudget reached, full candidates availablePartial result
StartedTime budget reached with no fully validated candidateTimeout

Started

Condition and effect
Search space fully explored and at least one valid connection fully assessed
Subsequent state
Result

Started

Condition and effect
Search space fully checked without permissible path
Subsequent state
No route

Started

Condition and effect
Budget reached, full candidates available
Subsequent state
Partial result

Started

Condition and effect
Time budget reached with no fully validated candidate
Subsequent state
Timeout

Generations prevent mixed timetable versions.

Generations prevent mixed timetable versions.

Activation atomically swaps a pointer.

A new import reaches the platform during ongoing searches.

If A activates generation 8 first, B receives a conflict and must revalidate against 8. If B activates 8 first, A receives a conflict. Neither activation is partial.

Alternative considered
Overwriting individual stops during a search mixes data versions.
Trade-off
Old generations are preserved for ongoing requests.
Reassess
Storage pressure requires cleanup of old generations.

Try it yourself

Predict the winner when imports A then B, and B then A, both start from generation 7.

A hint for your attempt

A new import reaches the platform during ongoing searches.

Compare with a possible solution
A first
A activates generation 8; B receives a conflict and must revalidate against 8.
B first
B activates generation 8; A receives a conflict. Neither activation is partial.

Apply to your project

How does this principle apply in your own project: Generations prevent mixed timetable versions.

Step 6: Imports and queries have separate runtimes. Which conditions ensure a valid result?