Answer both independent system design prompts. For each one, clarify requirements, propose APIs, describe core data models, explain the architecture, discuss scaling and reliability, and identify trade-offs.
-
Design a durable queue or event-streaming service
Design a distributed queue service similar in spirit to a high-throughput log-based messaging platform. It should allow producers to publish messages, consumers to read messages, consumer groups to track offsets, and users to replay historical messages within a retention window. The system should support ordering within a partition, high throughput, durability, replication, backpressure, monitoring, and failure recovery.
-
Design a taxi request service with user-selected drivers
Design the request and matching flow for a ride-hailing service. The requirements differ from a standard one-driver assignment model:
-
A rider creates a ride request.
-
The system notifies many nearby drivers.
-
Multiple drivers may accept or express interest in the same request.
-
The rider chooses one driver from the accepted drivers.
-
The chosen driver must explicitly confirm the rider's selection.
-
Only after confirmation should the trip become assigned.
Handle driver/rider cancellations, timeouts, concurrent acceptances, duplicate requests, stale locations, and race conditions.