Design: Message Queue System
Design the core message queue system including producers, consumers, queue storage, and delivery mechanisms. Out of scope: detailed UI, security/authentication, and complex routing features.
Functional Requirements
FR1: Allow multiple producers to send messages asynchronously
FR2: Allow multiple consumers to receive and process messages
FR3: Ensure messages are delivered at least once
FR4: Support message ordering within a queue
FR5: Handle message persistence to avoid data loss
FR6: Support message acknowledgment from consumers
FR7: Allow scaling to handle 10,000 messages per second
FR8: Provide low latency with p99 latency under 100ms for message delivery
Non-Functional Requirements
NFR1: System must be highly available with 99.9% uptime
NFR2: Messages must not be lost even if a consumer or producer crashes
NFR3: Support horizontal scaling for producers and consumers
NFR4: Latency target: p99 < 100ms for message delivery
NFR5: Throughput target: 10,000 messages per second