top of page
Search
understandingdevop

DevOps Interview: System Design of messaging app

So whenever this type of question is being asked by the interviewer, don't try to rush. Think patiently what all features and components you need in your messaging app or you are always free to ask your interviewer.

Let's start there should be messaging servers that will be in autoscaling, and if those are in autoscaling, it means multiple servers. I will also be needing a load balancer so that client will be reaching to my load balancer. And depending on the algorithm, the load balancer will route the traffic to those messaging servers.

Let's say client A is trying to send message to client B, so firstly client A will establish a connection with the messaging server, that means messaging server will create a thread or process for the client A. the message which is sent by client A is being received by the messaging server and the thread or process creates a queue for the client A and also creates an entry of mapping thread id or PID to the client name. in the same way, there is a mapping of PID for client B. As soon as the messaging server gets the message from client A to be sent to client B, the messaging server will look into that table of the PID and client name mapping. And the messaging server will put the message into client B's queue if the message is for a client B(whenever messaging server creates a connection with any client it creates two things one is PID and another is a queue for storing the messages ). The process of every client keeps on reading a queue if there are any messages. As soon as it finds some messages for the respective client, it delivers the message to the client.


What if client B is not connected to the internet? So in this scenario messaging server will store the messages into its database. As soon as client B tries to establish the connection with the messaging server, the messaging server will first check if any messages are pending for client B into the database, if yes, it will pull those messages to client B's queue immediately and further the process of client B will pick it up from that queue and deliver it to client B.


How single tick, double tick, blue tick will works? Whenever the messaging server receives the message from the client it sends an acknowledgment to the client which is nothing but the single tick which we see. And next, whenever the messaging server delivers the message to client B, it gets some kind of acknowledgment from client B, so messaging server updates client A with double tick by saying a message has been delivered to the client B. The third thing is when client B opens the message it sends some kind of response again to the messaging server under the hood, so the messaging server updates the client A displaying blue tick which means your message has been read by client B.


Thank you Tech Dummies youtube channel for the explanation.

102 views0 comments

Comentarios


Post: Blog2_Post
bottom of page