Search⌘ K
AI Features

Requirements of WhatsApp’s Design

Define the functional and non-functional requirements for a highly scalable chat service like WhatsApp. Learn how to balance consistency, security, and low-latency needs. Practice resource estimation to calculate the necessary storage, bandwidth, and server capacity for billions of daily messages.

We'll cover the following...

“”

  • <a href=\"#Requirements\" aria-label=\“Read more about Requirements\” >Requirements
    • <a href=\"#Functional-requirements\" aria-label=\“Read more about Functional requirements\” >Functional requirements
    • <a href=\"#Non-functional-requirements\" aria-label=\“Read more about Non-functional requirements\” >Non-functional requirements
  • <a href=\"#Resource-estimation\" aria-label=\“Read more about Resource estimation\” >Resource estimation
    • <a href=\"#Storage-estimation\" aria-label=\“Read more about Storage estimation\” >Storage estimation
    • <a href=\"#Bandwidth-estimation\" aria-label=\“Read more about Bandwidth estimation\” >Bandwidth estimation
    • <a href=\"#Number-of-servers-estimation\" aria-label=\“Read more about Number of servers estimation\” >Number of servers estimation
    • <a href=\"#Try-it-out\" aria-label=\“Read more about Try it out\” >Try it out
  • <a href=\"#Building-blocks-we-will-use\" aria-label=\“Read more about Building blocks we will use\” >Building blocks we will use
""

Requirements

Let’s scope the WhatsApp design by identifying the following requirements.

Functional requirements

  • Conversation: Support one-on-one and group conversations.

  • Acknowledgment: Provide message delivery status (sent, delivered, and read).

  • Sharing: Enable sharing of media files, including images, videos, and audio.

  • Chat storage: Persist messages for offline users until they are successfully delivered.

  • Push notifications: Notify offline users of new messages when they reconnect.

Note: “Offline” refers to users disconnected from the internet. The system sends push notifications when they reconnect. “Online” users are actively connected and receive real-time messages.

Non-functional requirements

  • Low latency: Deliver messages with minimal delay.

  • Consistency: Deliver messages in order and ensure chat history is consistent across all user devices.

  • Availability: Prioritize high availability, though trade-offs may be made to ensure consistency.

  • Security: Implement end-to-end encryption so only communicating parties can access message content.

  • Scalability: Support an increasing number of users and daily messages.

The non-functional requirements of the WhatsApp system
The non-functional requirements of the WhatsApp system

Resource estimation

For capacity planning, assume more than 2 billion daily active users (DAUs) who send more than 100 billion messages per day. Estimate the storage, bandwidth, and server capacity required to support this load.

Storage estimation

We assume 100 billion messages per day with an average size of 100 bytes. Servers retain messages for 30 days; if a user does not reconnect within this window, messages are permanently deleted.

...