Messenger App System Design

February 10, 2023 | 1 Minute Read

Table of content:

Messaging applications such as WhatsApp/Facebook Messengers provide instant messaging services to users.

Functional Requirements

  1. System should be able to support one-to-one/group messaging
  2. Users should be able to see live status
  3. System should support file sharing(on receive deletion)

Non-Functional Requirements

  1. System should highly reliable/scalable
  2. System should be highly available with eventual consistency

Capacity Estimation

Throughput
  • DAU : 50M users and each user watch 10 messages/day
  • 500 million messages/day -> 5000 RPS
  • 10% of users upload files-> 50 million files/day
Storage
  • 50 M X100 = 5GB/day

High Level System Design

WhatsApp High Level System Design
  • User send messages to user/group which is handled by chat server
  • Chat server extracts files (if any) upload into media storage.
  • Event triggered message queue and notification send to user/group via notification server
  • Presence server uses heartbeat protocol to check whether user active/not
  • Communication between chatServer and user happens through WebSocket(Duplex)/ SSE/Long Polling

Algorithms

  • WebSockets
  • Server Sent Events
  • Long Polling
  • HeartBeat Protocols