System Design for chat system

System Design for chat system

Play this article

The system design process has the following pattern:

  1. Gather Requirement

  2. Capacity measurement

  3. Propose High-level design

  4. High-level Design

    a.Technology selection

    b.Service selection

    c.Think of scalability

    d.Storage selection

  5. API Design

Data Modal


1) Kind of chat -> 1-1 chat and group chat

2)Should support 70 million daily active users

3)Group of max 200 peoples

4)System should allow only text messages

5)Maximum 5000 chars

6)History should available forever.

Propose a very high-level design and buy-in

For a chat system, client needs to connect chat service using one or more network protocols and choice of network is important.

HTTP Protocol communication is very common. Client can initiate HTTP connection by providing a keep-alive header to keep the connection persistent. Initially, Many company started http protocol but it is not reliable.

Since the Http connection is initiated by the client end so from receiver side it is very difficult and it is not trivial to send message from the server. Server-initiated connection are used to persistent connection and easy to send and receive message.

There are few technique- Polling, long polling , and Websocket.

Websocket is the most common solution for sending asynchronous updates from server.

Next will post on Service and Storage selection.......