Design: One-to-one Messaging System
Design covers backend architecture, data storage, and message delivery mechanisms. Client UI and encryption details are out of scope.
Functional Requirements
FR1: Allow users to send and receive messages privately between two users
FR2: Support message delivery in real-time with low latency
FR3: Store message history for users to view past conversations
FR4: Support message read receipts to show if a message was read
FR5: Allow users to be online or offline; deliver messages accordingly
FR6: Support up to 1 million active users with up to 10,000 concurrent connections
FR7: Ensure message order is preserved between two users
Non-Functional Requirements
NFR1: System should have p99 latency under 200ms for message delivery
NFR2: Availability target of 99.9% uptime (about 8.77 hours downtime per year)
NFR3: Messages must be durable and not lost
NFR4: Support mobile and web clients
NFR5: Privacy: messages are only visible to the two users involved
