intermediate
2 min answer
A logistics platform processes tracking events through validation, enrichment, deduplication, state transition and fan-out. What does the pipes-and-filters shape buy, and where does it break down?
Show the full answer Hide the answer
What it buys
- Independently scalable stages. Enrichment may be expensive and deduplication cheap, and each stage can be sized independently — which is impossible in a single monolithic handler.
- Independent failure and retry. A failure in enrichment does not lose the message; it retries at that stage.
- Composability. A new stage inserts without touching the others, which for a pipeline that accumulates requirements is a substantial benefit.
- Testability of each stage in isolation, since each is a function from input to output.
Where it breaks down
- Latency accumulates. Each stage adds a hop and a queue, so a five-stage pipeline has five queueing delays. For a live tracking path that may exceed the freshness requirement, and the answer is a short-circuit path for the latency-sensitive subset rather than a faster pipeline.
- Debugging crosses stages. Answering "what happened to this event" requires correlation across five systems, which needs a business correlation identifier on every stage's output — the shipment identifier, not just a trace ID.
- Backpressure must propagate. If a late stage slows, earlier stages must slow rather than accumulating an unbounded queue. An unbounded queue converts a throughput mismatch into memory exhaustion and then an outage.
- Ordering across stages. Two events for the same shipment can overtake each other if any stage processes concurrently, which breaks state transitions. Per-shipment partitioning must be preserved through every stage, and it is usually lost at one of them.
The specific decision this domain forces
Separate the paths by consequence. Live map tracking needs the latest position and can drop everything older — it should conflate. Route reconstruction needs completeness but tolerates minutes of delay. Forcing both through one pipeline means paying the strictest requirement of each: completeness and low latency simultaneously, which is the expensive combination.
Edge filtering before the pipeline is the largest single reduction available: a device transmitting on meaningful change plus a heartbeat removes most of the volume at the cheapest possible point.