Design One-to-One Chat
Company: Anthropic
Role: Software Engineer
Category: System Design
Difficulty: medium
Interview Round: Onsite
Design a scalable one-to-one chat system.
Scope:
- Only direct one-to-one messaging is required.
- Group chat, public channels, workspace features, and threaded conversations are out of scope.
Your design should cover:
1. Core user flows for sending and receiving a message.
2. Message persistence and retrieval.
3. Delivery when the recipient is online.
4. Delivery when the recipient is offline.
5. How the system detects whether a user is online.
6. How client sessions and WebSocket connections are stored and managed.
7. Ordering, retries, deduplication, and delivery acknowledgements.
8. The tradeoffs between using Kafka and Redis in the design.
9. The internal principles of Kafka that matter for this system, such as partitions, ordering, offsets, and consumer groups.
State your assumptions about scale, latency, and reliability requirements before presenting the design.
Quick Answer: This question evaluates expertise in designing scalable, real-time one-to-one messaging systems, testing knowledge of distributed systems principles, message persistence and retrieval, delivery semantics, session and WebSocket management, ordering, retries, deduplication, and trade-offs between streaming and in-memory technologies such as Kafka and Redis. It is commonly asked to assess architectural reasoning about latency, availability, ordering guarantees and reliability within the System Design domain, and requires a mix of conceptual architectural understanding and practical implementation-level considerations.