DEV Community

Cover image for System Design for chat system
Vijendra-Tech
Vijendra-Tech

Posted on

System Design for chat system

The system design process has the following pattern:

Gather Requirement

Capacity measurement

Propose High-level design

High-level Design

a.Technology selection

b.Service selection

c.Think of scalability

d.Storage selection

API Design

Data Modal

Requirements:

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

Image description

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.

Image description

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

Top comments (0)