You want to design a group messaging system that supports millions of users sending messages in real-time. Which architecture best supports scalability and low latency?
Think about how to separate concerns and handle high load efficiently.
Microservices with message queues allow scaling individual components and decouple message routing from storage, supporting millions of users with low latency.
Your group messaging system expects 10 million active users sending an average of 20 messages per day. Assume average group size of 130 members. Each server can handle 1000 messages per second. How many servers are needed to handle peak load assuming peak traffic is 10% of daily messages concentrated in 1 hour?
Calculate total messages per hour during peak, apply fanout for deliveries, then divide by server capacity.
Daily sends = 10M × 20 = 200M. Peak hour sends = 10% = 20M sends/hour ≈ 20M / 3600 ≈ 5556 sends/sec. With average group size 130, peak deliveries/sec ≈ 5556 × 130 ≈ 722K. Servers needed ≈ 722K / 1000 ≈ 722 (720 servers).
Which data storage approach balances fast message retrieval and efficient storage for a group messaging system with millions of groups?
Consider scalability and write/read patterns for group messaging.
NoSQL databases partitioned by group ID allow horizontal scaling and fast writes with append-only logs, which suit high write throughput and efficient retrieval.
Which message delivery guarantee ensures that every message sent to a group is received exactly once by all group members, even if some servers fail?
Think about avoiding duplicates and message loss.
Exactly once delivery guarantees each message is received once and only once, preventing duplicates and losses even during failures.
In a group messaging system, what is the correct sequence of components involved when a user sends a message to a large group?
Follow the logical flow from client to delivery.
The user sends the message to the API gateway, which forwards it to the routing service. The routing service stores and publishes the message, then the delivery service pushes it to members.
