Tuesday, August 13, 2019

Case study: Designing Facebook messenger

August 13, 2019

Introduction


It is my favorite topic called designing Facebook messenger. I like to write a short case study so that I can track how good I am in terms of system design, my curiosity level, and my determination to push myself hard to learn beyond algorithm and data structure problem solving.

Case study

I like to study Grokking system design lecture notes first, and then write down my study notes.

I like to write down things used in the system design.

Messages handling
Pull model
Push model

How to maintain an open connection with the server?

HTTP Long Polling or WebSockets

The long polling request can timeout or can receive a disconnect from the server, in that case, the client has to open a new request.

How many chat servers we need?

Plan for 500 million connections at any time, a server handles 50K concurrent connection at any time, we would need 10K such servers.

How do you know which server holds the connection to which user?

Load balancer, map each UserID to a server to redirect the request.



No comments:

Post a Comment