Nipun Goyal

Product Growth
October 17, 2024

Nipun Goyal

October 17, 2024
Product Growth

Decoding WhatsApp’s Scalable Infra

Hi There,

WhatsApp has about 3 billion monthly active users worldwide. And what’s more astonishing is that 140 billion+ messages are sent via WhatsApp daily. One can’t help but wonder how it handles so many concurrent users and messages.

In-app messaging has become crucial in every business no matter the use case. It facilitates conversations, engagement, and retention. If you need a closer look at this feature’s tech stack, what better example do we have than WhatsApp?

WhatsApp has built a very sophisticated frontend and backend that handles a scalable user base with utmost security. Today, let’s take a deep dive into their architecture and system design to understand how WhatsApp really works.

The Frontend

First things first, WhatsApp supports nearly all platforms. It’s available on iOS app, Android app, desktop app, web app, and Windows Phone app. They have built a native app for each of these platforms using the following front-end language(s):

  • Android: Java
  • iOS: Swift
  • Windows Phone: C#
  • Web app: JavaScript
  • Mac Desktop app: Swift/Objective-C
  • PC Desktop app: C/C#/Java

How WhatsApp Stores Chat Locally

This is the heart of WhatsApp and the secret behind its end-to-end encryption feasibility. They use the SQLite database, which stores the data/conversations on your device locally. This improves WhatsApp's performance in several ways:

Conversation Storage: When the data is stored locally, it becomes highly efficient for users to search through their message history and retrieve conversations. Since the messages are being extracted from local DB instead of APIs, the load time is significantly faster.

End-to-end encryption: When you first install WhatsApp, the app generates a pair of cryptographic keys for your device. When a message is sent, WhatsApp converts your message into a ciphertext that can only be decrypted by the recipient’s private key. Thus keeping the messages encrypted and unreadable.

Message Queuing: Have you ever tried sending a message on WhatsApp without an internet connection? It gets queued but doesn’t deliver. This is the highlight of WhatsApp. The message doesn’t get lost and is delivered once the connection is re-established.

The Backend

The backend of WhatsApp is a combination of technologies that ensure its scalability, reliability, and high performance.

WhatsApp uses Erlang as its main programming language which is designed to handle high concurrency and scale. Its lightweight process model manages millions of active users without performance degradation. Another highlight of Erlang is its fault-tolerant capabilities.

Each Erlang process is isolated from others, which means that a failure in one process doesn’t affect the others.

WhatsApp’s technology is a collection of many such advanced backend systems including a modified version of XMPP as its protocol to handle message delivery, and FreeBSD to manage high system loads, making it immune to errors or faults.

Final Thoughts

WhatsApp has put a lot of thought into building a strong foundation for its app. A lot of the features in its tech stack were specifically chosen for the ability to scale and handle extremely high concurrency. But if you are trying to build an app, it doesn’t have to be this comprehensive.

Many popular dating apps or even shopping apps do not need the amount of scale that WhatsApp does. In other words, the WhatsApp tech stack, while perfect for WhatsApp, may not be the best solution for you.

Creating a chat app like WhatsApp can take years. Well, the good news is you don’t have to wait this long. With LikeMinds' pre-built Chat SDK, you can integrate an intelligent chat into your app within 15 minutes. Sounds interesting?

Supercharge your retention with in-app social features

Deploy customised features on top of chat and feed in 15 minutes using LikeMinds SDK.

Schedule a demo!
Image showing Resource Library, which is a inApp feed usecase.

Share now

NEWSLETTER

Get a front row seat to everything happening at LikeMinds including some curated expert insights each week, delivered straight to your inbox.
We promise to not spam. 🤝🏻

Sign Up Now!

Follow us

Product Growth

Read more stories

Decoding WhatsApp’s Scalable Infra

Nipun Goyal
/
October 17, 2024
/

Hi There,

WhatsApp has about 3 billion monthly active users worldwide. And what’s more astonishing is that 140 billion+ messages are sent via WhatsApp daily. One can’t help but wonder how it handles so many concurrent users and messages.

In-app messaging has become crucial in every business no matter the use case. It facilitates conversations, engagement, and retention. If you need a closer look at this feature’s tech stack, what better example do we have than WhatsApp?

WhatsApp has built a very sophisticated frontend and backend that handles a scalable user base with utmost security. Today, let’s take a deep dive into their architecture and system design to understand how WhatsApp really works.

The Frontend

First things first, WhatsApp supports nearly all platforms. It’s available on iOS app, Android app, desktop app, web app, and Windows Phone app. They have built a native app for each of these platforms using the following front-end language(s):

  • Android: Java
  • iOS: Swift
  • Windows Phone: C#
  • Web app: JavaScript
  • Mac Desktop app: Swift/Objective-C
  • PC Desktop app: C/C#/Java

How WhatsApp Stores Chat Locally

This is the heart of WhatsApp and the secret behind its end-to-end encryption feasibility. They use the SQLite database, which stores the data/conversations on your device locally. This improves WhatsApp's performance in several ways:

Conversation Storage: When the data is stored locally, it becomes highly efficient for users to search through their message history and retrieve conversations. Since the messages are being extracted from local DB instead of APIs, the load time is significantly faster.

End-to-end encryption: When you first install WhatsApp, the app generates a pair of cryptographic keys for your device. When a message is sent, WhatsApp converts your message into a ciphertext that can only be decrypted by the recipient’s private key. Thus keeping the messages encrypted and unreadable.

Message Queuing: Have you ever tried sending a message on WhatsApp without an internet connection? It gets queued but doesn’t deliver. This is the highlight of WhatsApp. The message doesn’t get lost and is delivered once the connection is re-established.

The Backend

The backend of WhatsApp is a combination of technologies that ensure its scalability, reliability, and high performance.

WhatsApp uses Erlang as its main programming language which is designed to handle high concurrency and scale. Its lightweight process model manages millions of active users without performance degradation. Another highlight of Erlang is its fault-tolerant capabilities.

Each Erlang process is isolated from others, which means that a failure in one process doesn’t affect the others.

WhatsApp’s technology is a collection of many such advanced backend systems including a modified version of XMPP as its protocol to handle message delivery, and FreeBSD to manage high system loads, making it immune to errors or faults.

Final Thoughts

WhatsApp has put a lot of thought into building a strong foundation for its app. A lot of the features in its tech stack were specifically chosen for the ability to scale and handle extremely high concurrency. But if you are trying to build an app, it doesn’t have to be this comprehensive.

Many popular dating apps or even shopping apps do not need the amount of scale that WhatsApp does. In other words, the WhatsApp tech stack, while perfect for WhatsApp, may not be the best solution for you.

Creating a chat app like WhatsApp can take years. Well, the good news is you don’t have to wait this long. With LikeMinds' pre-built Chat SDK, you can integrate an intelligent chat into your app within 15 minutes. Sounds interesting?

Supercharge your retention with in-app social features

Deploy customised features on top of chat and feed in 15 minutes using LikeMinds SDK.

Let's start!