Whatsapp System Design: Chat Messaging Systems for Interviews

The Whatsapp system architecture is a common system design interview question. This interview question asks us to select a set of features like sending chat messages, read receipts, group messaging and last seen visibility.

The chat system must be scalable and have other non functional requirements like message ordering, retrial, idempotency, load balancing and image sharing.

“Grokking the System Design Interview” Course:
Use the coupon code…


  1. Great Video, Really liked this one…!!!
    Just wanted to ask that for the last seen timestamp wouldn't it be better if the client sends a request(Or should I say message!) to the server when the user exits the messaging app(maybe when he exits the main app activity)., Wouldn't it save a lot of overhead for the last seen timestamp(Not taking into consideration the online stamp)?

  2. wonderful video bro, the content is great. However, can you get a board eraser, using hands is a bit annoyed for me haha. But anyway good content !!!

  3. Well they are creating micro service for last seen functionality and what I am doing is building monolithic application :p

  4. The diagrams are a little complicated towards the end, can someone explain where nd how the message queue is used?

  5. You focus on app logic only and not on the distributed system components, architecture and selection of technologies, bottlenecks mitigation and pros/cons of decisions you made. In a real interview this would not be sufficient and would not pass.

  6. Actually WhatsApp or any chat application uses SIP and MSRP protocol. Most of the problems you discussed are already solved by these protocols

  7. it makes me feel sad to realize that the clg years r wasted and I didn't learn such cool stuff

  8. I have one query related to the online feature.. If there is a threshold time for which the user last seen is checked, then wouldn't this lead to wrong status being displayed to the other user for that few seconds?
    What I believe from the client app perspective, whenever the
    app is brought to foreground – the server is informed that the user is online…
    app goes to background/killed – server is informed user has gone offline and this is stored as the last seen..

    like this there are a few more app and device states that can be checked for at the client end..
    One end case would be if the device abruptly restarts or hangs, in that case the server can use the threshold logic..

    Please correct me if i am wrong.!
    Nonetheless, you are creating a very useful and genuine content..!

  9. Hi Gaurav,

    Thanks for helping many students through your videos.
    I just wanted to know how to design classes or how do you define system interface definitions for above.

    As I have time I am trying to learn System design. Could you please help.

  10. Awesome video! Why did we need to have a separate service called sessions if the gateway a user is connected to is kept in the database? It seems to me the sessions isnt doing anything other than fetching gateway:user mappings from the db, what am I missing?

  11. Hi Gaurav,
    Thank you for the informative video!
    I have a question or clarification, are you referring the gateway as a load balancer? Or different services (microservice)?
    At first glance I think it would make sense that it's a load balancer but just wanted to confirm because it seems more like a "server" and scaled horizontally.
    It would be helpful if you could reply.
    Thank you 🙂

  12. YT: Here's a nice video on chat system design
    ME (first impression): I love your shirt.

    Now, let me enjoy the video.

  13. You're really underrated in the developer circle. People need to watch all this a lot more than programming basics.

  14. I'm really dying to face a company that would allow these type of interviews where real life industrial problems will be asked to tackle. I hate interview process of MNCs where they screen real talent over academic marks and speed of solving aptitude. I mean seriously, what does software architecture has to do with with if I could find cube root of 140987 in 3 seconds?

  15. Gaurav, you may want to split up the sessions service into an authentication service and a messaging service, especially for future feature extensibility where the messaging service may store some session meta data which can be queried by another service to say, serve annoying ads or gift suggestions and other such creepy stuff popularized by FB etc.

  16. You can simplify this quite a bit by using SignalR. Use AzureSignalR if you want to have microservices or some type of loadbalanced services for scale. SignalR also provides long-polling fallbacks should the Websockets protocol fail.

  17. What happens if Gateway 2 is down? Will user B automatically get redirected to other gateways?

Leave a Reply

Your email address will not be published. Required fields are marked *