Design Omegle
Difficulty: MEDIUMCategory: HLDFrequency: 1Asked On 2025-06-24
Problem Statement
Design a system similar to Omegle that enables anonymous, one-to-one, real-time chat between users. The system should support the following core functionalities:
Functional Requirements:
1.One-to-One Matching: Randomly pair two online users for a chat session.
2.Limited Chat Messages: Each chat session should allow only a fixed number of messages (e.g., 20 messages per session).
3.Real-Time Messaging: Messages should be delivered instantly between matched users with minimal latency.
4.Session Handling:
•Support connecting and disconnecting users gracefully.
•Ensure users are re-matchable after a session ends.
Non-Functional Requirements:
•Scalability: Support thousands to millions of concurrent users.
•Low Latency: Ensure near real-time delivery of messages.
•Stateless Frontend: No authentication or user profiles — sessions are anonymous.
•Fault Tolerance: Gracefully handle dropped connections or server failures.
Design the system architecture, key components, data flow, and communication protocols required to achieve the above goals.