No video

Whatsapp System design or software architecture

  Рет қаралды 252,555

Tech Dummies Narendra L

Tech Dummies Narendra L

Күн бұрын

Пікірлер: 281
@vipulsingh4637
@vipulsingh4637 3 жыл бұрын
Awesome video. Few points :- i) We can use indexing on UID for faster retrievals. O(n) to O(log(n)) ii) Spawning a thread for every user is not efficient. Instead, we can use a dynamic threadpool. iii) Similarly, having a queue per user is not efficient. Instead, we can have a global queue with object (message, action like send/receive, uid) iv) Since you are using DB for storing message in case user is not online, we need to implement a disaster recovery mechanism i.e. replication. v) We can also implement blocked contacts by storing list of blocked UIDs for each user in the DB & we can drop such messages in web server.
@mahee96
@mahee96 2 жыл бұрын
actually whatsapp and other messaging apps use very customized protocols and language features to cater specific needs, such as Erlang which is extremely useful where millions of lightweight processes might need to be started and each other doesn't need to share data (everything is immutable)...also their xmpp based messaging uses extremely compressed payload compared to normal xml data transfer. These are implementation details but these are what makes the design itself eventually.
@ajinkyagawali6442
@ajinkyagawali6442 5 жыл бұрын
You are pretty thorough about the subject and it is reflected by the way you teach. A lot of people are usually confused as they have a vague idea about what to speak. This shows that you take efforts perparing for the delivery of the content. Thank you so much for your efforts to make these videos. I am learning a lot.
@RanjithVj404
@RanjithVj404 3 жыл бұрын
Clear and better than other WhatsApp design videos on KZbin. Thanks!
@visitor-in-the-world
@visitor-in-the-world 3 жыл бұрын
the guy has done amazingly! what I don't fully understand is the pid uid approach. All the messaging servers sit behind ALB. If a user session is bound with a pid in a specific server, it will lower the efficiency of load balancing, cuz the user will stay with that server during the conversation session. It's doable, but not ideal, IMO.
@dibyendusarkar6821
@dibyendusarkar6821 3 жыл бұрын
Well firstly, this video is really good. One part which is missing is you did not consider multiple messaging server instances running. This actually raises a very important question. One server let's say maintain persistent connection, what if that goes down for some reason?
@asambatyon
@asambatyon 3 жыл бұрын
I love this content. Just for people who want to read, I got a couple of suggestions here: I personally would use the hearthbeat to keep the process alive. Once the heartbeat stops, or messages fail to be delivered, the process responsible for a client shutdowns and writes the shuttingdown timestamp in the DB and that is the last seen time. It has much less writes to the DB. For asymmetric encryption one would use the public/private key pairs to encrypt a common secret key (that is how you use it usually in SSL and other protocols) since asymmetric encryption is very expensive in both time and computing resources. You don't want to spent most of your processing power on encryption primitives (even less in a cellphone).
@dillon9347
@dillon9347 2 жыл бұрын
How do you recognize when heartbeat has stopped?
@balajireddy8985
@balajireddy8985 5 жыл бұрын
Excellent brother..before seeing your videos I never thought about the system design. Now I exited to understand every application system design . Thanks for everything.!
@abrarisme
@abrarisme 5 жыл бұрын
Thanks, that was pretty great. Would love to see an expansion of how encryption would work for the system and the tradeoffs you'd get between symmetric/asymmetric encryption.
@TechDummiesNarendraL
@TechDummiesNarendraL 5 жыл бұрын
Considered :) and Thanks
@talivanov93
@talivanov93 4 жыл бұрын
Thank you for the video, it was very helpful! Great Idea using the CDN. One point that I would like to mention, that you don't have to send a heartbeat . Because with WebSocket there are events, for example connected and disconnection, so heartbeat might be wasteful.
@Collins01
@Collins01 2 жыл бұрын
so, when a user I disconnected, the timestamp at that point is sent to the small dB holding the user's active status right?
@stobikoc
@stobikoc 5 жыл бұрын
Nice video btw. However, there are questions that I wanted to ask. When A sends a message to B and B is yet to connect to the server, your explanation said that the message is kept in the global DB until the PID of B in the server is created. When the PID of B is created, the server did a full lookup to the DB in order to find out what messages that is not received by B. My question is that: 1. Does the server evoke a trigger to lookup the global database whenever a new PID entry is formed? 2. If the server evoke a lookup trigger to the global DB with an assumption of there maybe a million of pending messages in the global DB. Does looking up without updating the global DB or indexing could scale up the system? 3. What is the main core /pattern of every real life system? Does multiple queries by giving heartbeat will slow down the performance?
@meiliangwhut
@meiliangwhut 4 жыл бұрын
Steven Candra the design listed in the video is a poor design. I cannot believe he is putting the pid in the database. The thread id is transient.
@nitinkulkarni7942
@nitinkulkarni7942 4 жыл бұрын
@@meiliangwhut I dont think, he is saying to store the pid in the DB. He is storing the uid of the user B and the message for user B. When user B connects, and reports that is it connected, we have to find all undelivered messages and send it to user B. Also even though pid is transient, it will alive while the connection is on. You have to know which messaging server the receiver is connected to
@neerajcrespo
@neerajcrespo 3 жыл бұрын
Few Questions which I am pondering right now 1. How does the long running thread/process work in Messaging server? Does it mean that the connection from client to server is not stateless but stateful and every time it finds the same process? Does that mean that the process is running on a single central machine and not in a horizontally scaled pods? 2. Is it client responsibility to poll for the messages after some time interval or is it the server's job to push messages to the client? If its the later then does that mean that Billions of client (devices) are making a stateful connection to server? is the protocol being used here is HTTP?
@akaukuntla
@akaukuntla 5 жыл бұрын
Very educational. The other very important feature that wasn't addressed here is the 'group chat'. I wonder how WhatsApp handles them. If you could shed light on that as well, that would be awesome. Other than that, it simply awesome. Keep up the great work.
@parthacnp
@parthacnp 2 жыл бұрын
It would be very similar to the one to one chat logic. Except that, Whatsapp stores the users in a group. So, when a message sent to a group, whatsapp, takes the users in the group and sends to the corresponding Queues through the PIDs. If the user is offline, it is stored in DB against the userid.
@ayushjindal4981
@ayushjindal4981 3 жыл бұрын
For last seen, instead of continuous heart beat, the user can update the column whenever he is closing the app and make the column as Null whenever he comes online Here null specifies that the user is online...
@sammed.sankonatti
@sammed.sankonatti 2 ай бұрын
Thats an excellent explanation. Thats marks the start of my system design interviews preparation. 24-05-2024
@JUSTINHBK007
@JUSTINHBK007 5 жыл бұрын
Narendra, I will pass my interview thanks to your tutorials !! I owe you a beer.. or two
@TechDummiesNarendraL
@TechDummiesNarendraL 5 жыл бұрын
All the best:)
@somerandomguy000
@somerandomguy000 3 жыл бұрын
Did you pass?
@JUSTINHBK007
@JUSTINHBK007 3 жыл бұрын
@@somerandomguy000 I am a Software Development Manager at Amazon now !
@somerandomguy000
@somerandomguy000 3 жыл бұрын
@@JUSTINHBK007 congrats man!
@SubhramRana
@SubhramRana Жыл бұрын
Did not explain the case where sender and receiver clients are connected to two separate "message servers". In that case the message cant be sent to in-memory-queue. A dedicated messaging queue like sqs can be used to solve this.. This is a great explanation 💖💖
@user-lw3ws6ec2v
@user-lw3ws6ec2v 5 жыл бұрын
It would be impossible to use system threads for an application like Whatsapp so it is definitely Erlang's actors
@WalkingArchive
@WalkingArchive 4 жыл бұрын
@@shaaradpandey5546 It won't scale.
@WalkingArchive
@WalkingArchive 4 жыл бұрын
@@shaaradpandey5546 spring? no. It depends on how much users do you need to support. forget about spring, that's 90s tech
@Codeness23
@Codeness23 3 жыл бұрын
Even actors are threads, all you gotta look at is whether they are scaling across servers or on the same server.
@aneeinaec
@aneeinaec 3 жыл бұрын
Yes... He is explaning Erlang OTP framework in simple way... Only super light weight threading mechanisms will scale like this... WhatsApp itslef uses Erlang OTP I guess.
@odionedwards5538
@odionedwards5538 Жыл бұрын
😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊😊
@pramodprajapati9166
@pramodprajapati9166 5 жыл бұрын
Thanks so much for your time and effort.This section was missing from youtube or sometime they went into too much details which led to a disinterest in the topic. I don't know how, but somehow you are able to make these interesting and just the right amount of depth is explained. Really helpful and much appreciated.
@TechDummiesNarendraL
@TechDummiesNarendraL 5 жыл бұрын
Thanks :)
@jyotitolanikhanchandani9796
@jyotitolanikhanchandani9796 5 жыл бұрын
Very nice explanation, thank you very much! I would like to see the followup video talking about encryption and audio/video calling service.
@ravkrgmail
@ravkrgmail 4 жыл бұрын
Whatsapp like chat app often use MQ broker like kafka, rabbitmq to exchange messages across users. The server side code is lightweight for messaging but not for telephony. Server doesn't store messages in DB but are managed by message brokers i.e. A sends msg to server for B, Server put it on MQ for B destination (Q the B is listening to) and double tick the sender, B finds a msg for download and double tick the receiver, B downloads/saves the msg locally and Blue tick is done. At this point your msg is remove permanently from the server. Which is why you can't retrive a msg once you delete it. Media files are handled slightly differently. We don't need a hardcore monolithic server for msgs. IMO.
@harishkrish14386
@harishkrish14386 3 жыл бұрын
Thanks for the recommendation YT , was searching fr ur videos frm few months but was not particular but now im very specific learning from ur videos
@phoenixbird6834
@phoenixbird6834 5 жыл бұрын
When I saw this video, I had doubts that WhatsApp’s messaging server can handle 10 million concurrent connections. Those were arose on the basis that setup would hit limit of 65k because all the connections to the back end server would be from the load balancer, that means source ip, destination ip, destination port would be same for each connection. Then only variable would be source port. So load balancer won’t be able to create more than 65k connections. But I learnt that this can be solved by making backend server listen on multiple ports due to which we can have 64k * (no. of ports on which backend is listening), which can easily overcome 10 million connections limits (given that throughput of application server is high enough).
@dev-skills
@dev-skills Жыл бұрын
location sharing is another important use case but can be implemented similarly to text message as we here sent the latitude-longitude data.
@kushangowda
@kushangowda 4 жыл бұрын
What did I just hear? New thread/process to handle each peer? We are talking about billions of peers together here!
@ryan-bo2xi
@ryan-bo2xi 4 жыл бұрын
What is your idea ? Any standard http server handles request processing creating multiple threads unless you are using CGI.
@rdb8324
@rdb8324 6 жыл бұрын
This is really great and straightforward. I liked it better than Tushar Roy's video on the same topic
@ChandramouliMallampalli99
@ChandramouliMallampalli99 5 жыл бұрын
crisp, in depth and perfect ! thanks for your time
@rtripath
@rtripath 2 жыл бұрын
Great explanation. Some question on last seen design. Why you need a heart bit send by user at regular interval. If the user is connected to server it is the current time and once disconnected just store that time as last seen. So difference of current time minus that timestamp will be last seen. Once user reconnect to server it is again going to be current time as last seen.
@akashmahalik8001
@akashmahalik8001 2 жыл бұрын
I thought my dog was barking but it was in the video lol.
@jiayangsun7309
@jiayangsun7309 4 жыл бұрын
Personally, I think .(1) The message receiver and message delivery should be decouple into 2 separate service, and they could be fully stateless. They can be connected with a message queue service or sit behind service discovery directly. Put them in a single executable and pass message between process is feasible for very small user base, but it's not scalable at all. Besides, It makes the "Mess SERVER" hard to test. (2) If you have an abstract concept "channel" or "session" here, then it's easy to forward message with rpc or write it into DB. (3) real-time message is time sensitive and has high frequent requests. It's not a very good idea to write all message into DB. Instead, I would say we should only write message for offline users into two level DB (Memory + persistent).
@AbhishekKumar-yu2fy
@AbhishekKumar-yu2fy 4 жыл бұрын
Hi @Tech Dummies, Thanks for this video. But i have one doubt. As you have mentioned at 15:47 minute of this video, for every active client there would be a corresponding thread/process and a queue. But my point is - isn't it taking unnecessary space in memory just for being active. bcz whatsApp has billions of users. And if millions are just active( they are not doing messaging or call) , for them also process and queue will be created. Thank You !
@foysolahmedshuvo706
@foysolahmedshuvo706 2 жыл бұрын
I came here to ask the same question. Anyway, do you have any answer / Explanantion for this? though the question you asked two years ago. Thanks!
@jagjotsinghwadali3535
@jagjotsinghwadali3535 Жыл бұрын
Thank you for this lecture . Further, I have a query regarding design Problem Statement:- I have subcategories defined under Vehicle Class as :- Bike ,Car, truck, bus Further, there are different variants under each four categories Bike :- sport, standard Car :- sport, standard, electric Truck :- Mini Truck , Power Truck Bus:- Mini Bus, AC Bus I have to calculate the price based on variants. For example Mini Bus price. Question:- How should I define the classes ? 1. Keep only vehicle as a class . 2. Keep Vehicle as a base class and make bike, car, truck , bus as subclasses and they should inherit the base class. 3. make sports bike as class which will inherit bike class which will further inherit vehicle class
@adithyaks8584
@adithyaks8584 3 жыл бұрын
One thing I don't understand is how many threads will be active in the service instances and clarity around thread management. Also let's say we have millions of connections in one server, will there be calls to other servers for contacts who have connections in other server.(If so this could be the reason for some delay that we experience when contacting some remote contacts) Rest is superb!
@avinashyadav1
@avinashyadav1 6 жыл бұрын
Thanks man! these videos are really helpfull.
@anjalisharma7919
@anjalisharma7919 3 жыл бұрын
So neat and just rightly detailed. I regret finding your channel so late.
@computersciencebypandey1339
@computersciencebypandey1339 4 жыл бұрын
Hey, I think some example of duplex protocol should be mentioned. Just saying "TCP" does not provide complete picture. Mostly XMPP protocol (built on top of TCP) is used, and not, for example HTTP.
@adipratapsinghaps
@adipratapsinghaps 5 жыл бұрын
19:40 So when a new process is spawned when user B is back online, and since you are just storing uid and msg in the DB, and when that process reads msgs for B in the table, how does B know who is the sender of the msg? Shouldn't you be storing the sender_uid too in the db? Because you are sending the msg to B, but since B doesn't have the sender information, in which chat will it show the message?
@santoshdl
@santoshdl 4 жыл бұрын
in think message itself will be stored with sender_id on it. the app will parse the message into the user and message. in fact message here will be an array with message, id, timestamp, group_name etc. IMO
@shivaprasad.v.g7526
@shivaprasad.v.g7526 3 жыл бұрын
What happens if the thread is in different message server. Do we need to have network connectivity between those ?
@prafulsinghvit
@prafulsinghvit 3 жыл бұрын
Same doubt I was having and was reading through the comments section to see if others feel the same or I am too novice to understand details. Any explanation is appreciated. Thanks!!
@parthacnp
@parthacnp 3 жыл бұрын
I am not sure whether Whatsapp uses PID + data pipe combination. Same could be simplified by using separate Queues in a messaging server like RabbitMQ which can be scaled horizontally, with persistent messaging. So, whenever a message sent from A to B, the message could be put in B's Queue. When B connects, automatically, message would be read by B. Once B Acknowledges, the message would be removed from queue. But as u have mentioned, there could be a limitation on how many connections server can handle. Likewise , when a message is sent to a group, the message can be put in the queue of all users of the group. Encryption in case of Asymmetric keys, we encrypt with public key and receiver decrypts with private key. so , we would end up storing public keys of all contacts in local store?
@nilaysheth3283
@nilaysheth3283 3 жыл бұрын
But for every user will there be separate queue created?
@parthacnp
@parthacnp 2 жыл бұрын
@@nilaysheth3283 Yes. One queue per user because messaging systems are queue intensive.
@daleprather3026
@daleprather3026 3 жыл бұрын
Love your videos! Thank you. And the links in the description are very helpful as well.
@sameeshprajan6404
@sameeshprajan6404 3 жыл бұрын
just loved the way you explain and make it simple to understand!!!great video !! thanks
@thakurpavan
@thakurpavan 5 жыл бұрын
Good job and explained well. Just one suggestion it is always good idea to save in db first each message and then transfer it to the other user.
@RS-vu5um
@RS-vu5um 2 жыл бұрын
Excellent Tutorial. Keep up the good work
@9986698971
@9986698971 2 жыл бұрын
I believe sending receiving txt messages when clients are offline is done using a lightweight connection . For other use case of media files https protocol is being used . what prompted for this decision as only difference is payload
@logicboard7746
@logicboard7746 2 жыл бұрын
Brilliant! Just the right depth and clarity!
@windowcrystal4012
@windowcrystal4012 4 жыл бұрын
Don't get it why we need pair?
@nadirtariverdiyev8799
@nadirtariverdiyev8799 4 жыл бұрын
to match users and processes
@varunjain7360
@varunjain7360 3 жыл бұрын
awesome video. Wouldn't a single queue for a server handling multiple client connections be more efficient than 1-1 for the queue to thread/client?
@templestamilnadu869
@templestamilnadu869 Жыл бұрын
Really really really super great explanation bro👍👌👌👌
@andrejab74
@andrejab74 2 жыл бұрын
Very useful video, great explanation!
@rahulsharma5030
@rahulsharma5030 3 жыл бұрын
you are making complex things so simple.I did not know how 27 mins pass and know i feel like i know a lot of things.Thanks a ton.
@yashbhardwaj8510
@yashbhardwaj8510 4 жыл бұрын
I found your videos very interesting sir, just I watch them 1.25x speed and then it becomes awesome.
@pramodsingh344
@pramodsingh344 10 ай бұрын
very nicely explained. Thanks
@at_tap
@at_tap 5 жыл бұрын
Your videos are absolutely simple and to the point..real beauty....hats off, Great work!
@TechDummiesNarendraL
@TechDummiesNarendraL 5 жыл бұрын
@At thanks
@rishabkumar4940
@rishabkumar4940 4 жыл бұрын
Man, you need more light in the room, by the way, great video, Thanks!
@uday1225
@uday1225 3 жыл бұрын
Awesome one! Thanks! your videos are great! a quick question on this lecture. Say for an instance, if client A resides in a separate country (say US) from client B (say India), to which CDN A will upload the image in this scenario? If it's on US, how will the client B know which CDN url to connect to?
@tirupatirao7521
@tirupatirao7521 4 жыл бұрын
no words...simple and superb
@nakulkumar9415
@nakulkumar9415 5 жыл бұрын
What about the low level design? Dont you think if MySQL tables are used they cannot handle queries in millions? Please explain that also.
@rishabhgoel1877
@rishabhgoel1877 5 жыл бұрын
at 19:33, what if clients A and B are connected to different messaging server ?
@ravi-dc2xh
@ravi-dc2xh 5 жыл бұрын
I think process/thread which is handling A , first will try to find whether the B 's messaging server is in localNode or in remote node based on b's Id and last used location info in db , based on that it will handle that . if its in some remote node first it will send to that node .
@Chanchanchan169
@Chanchanchan169 3 жыл бұрын
Somewhat I think the bigger picture is still missing here, user base is definitely useful, then jump into Last seen directly?? What about other important facts like do we need to store all the messages, what about geo distribution, etc..
@sanjeev123455
@sanjeev123455 Жыл бұрын
You there! There is no videos from your end from last 2 year!
@manishwankhede17
@manishwankhede17 5 жыл бұрын
I thought its just a Send or Rec App...Gud explained
@satboddu
@satboddu 4 жыл бұрын
Nice Explanation. its my first system design understanding. Its clear
@ravishankarjoshi317
@ravishankarjoshi317 4 жыл бұрын
Great video, but I did not understand the media part properly. Can you please explain the justification for using the CDN for media? I think CDN will be useful only if the fraction of shared messages is very high. According to me CDN is like a cache, which will be useful if the number of items stored
@rishabhjain2404
@rishabhjain2404 4 жыл бұрын
So would you recommend a normal storage space to save the media temporarily(till B downloads it to his phone), something like Amazon S3?
@anastasianaumko923
@anastasianaumko923 Жыл бұрын
Great job, thank you so much 😌
@saurabh3032
@saurabh3032 3 жыл бұрын
How would a client connected to different message server interacts. Like A connected to server 1 and B connected to server 2. In that case, How will be the server 1 server 2 interaction.
@reg4026
@reg4026 3 жыл бұрын
I don't think WhatsApp is implemented in this way. The key to success of this App is the High Performance Messaging Bus Architecture built by the founders at Yahoo.
@akn4336
@akn4336 5 жыл бұрын
Very good video, thank you. qq! what if client B is connected to another server? How does server A (that client A is connected) communicate to all other servers and check to see if client B has any online process there?
@dev-skills
@dev-skills Жыл бұрын
0:53 - Group chat is also an important use case of Whatsapp
@adipratapsinghaps
@adipratapsinghaps 5 жыл бұрын
So are you talking about running a process for every client? Which keeps reading from queue?
@AAKASHJAIN-lx3pr
@AAKASHJAIN-lx3pr 3 жыл бұрын
Hey, You said at 10:03 that the server never knows the connection to the client and will never tries to connect to the client. Let us assume 2 situations 1. When the client is currently offline and now opens up the internet then the connection will be established with the message server . What happens to the connection when the client internet is on but the client is not doing any activity on the Whatsapp. Will the connection get closed? Then in that case how do we receive messages even when we are not actually using the App. If not then is Whatsapp keeping all the client connections live and running for all the clients having a Living Internet Connection even for a situation when the App is not being used. Are these client connection information stored somewhere on with the Message Server?
@MegaSk786
@MegaSk786 3 жыл бұрын
Really great videos, Thank you Narendra
@GiorGoS07031992
@GiorGoS07031992 Жыл бұрын
Great work!🎉
@anshugoel4381
@anshugoel4381 4 жыл бұрын
Can we have a messaging queue when the receiver is offline so that when receiver is online system does not has to query DB
@agrimsekhri7347
@agrimsekhri7347 6 жыл бұрын
Excellent video. Can you please tell something about how groups messages are handled ? And how offline members text will be managed in that case ?
@TechDummiesNarendraL
@TechDummiesNarendraL 6 жыл бұрын
Two ways you can do: First way: When a group message is sent from a User A, at the server the process which is responsible for user A will perform lookup in a Group to users mapping table(gid->[user-a, user-b, user-c])note: (You can cache it for faster lookup) (this is not the user-to-pid table shown in the table).When Process A figures out all the users of group, it will try to get get PID for each users to send it to the respective user’s processes via Queue/Pipe. If the user is not online, them messges are persisted in the DB. And when the offline users are back online, there respective processes(connection) reads all the pending messages from DB and delivers them. Second way: You can have separate set of dedicated workers which are responsible to dispense group messages only.when User A sends a group message. Process A hands over the message to dedicated group message workers and in turn these worker will Dispense messages to all the online members and saves messages for all the offline group members. If you like, please subscribe and share this video, Thanks
@agrimsekhri7347
@agrimsekhri7347 6 жыл бұрын
Thanks for the reply. But counter question asked to me was, saving the details for all the offline users for all messages in DB, will be creating a lot of rows. is it still be feasible ? Can cache be used for it ?
@TechDummiesNarendraL
@TechDummiesNarendraL 6 жыл бұрын
You can use cache where every you need to access the data very much faster. DB will create many rows, but that;s the best way to persist messages for long time. Alternatively. you can persist messages in cache for some time(24 hour) and if the user doesn't come online by then. you have to persist in the DB(NOSQL with user id, indexed) That way you will be saving messages of the users who doesn't come online for 24hours only.
@lebanese000
@lebanese000 4 жыл бұрын
love your videos. Pretty straight forward and informative. Keep it up.
@dev-skills
@dev-skills Жыл бұрын
3:30 - Should also clarify with the interviewer - how many messages per day will be sent by a user on average.
@umeshkumarroy5804
@umeshkumarroy5804 3 жыл бұрын
Simply Great Work. Awesome.
@neoli8110
@neoli8110 4 жыл бұрын
I thought there will be many Message Server, each MS handles number of user socket. and thread are listening on the sockets and forward to destination MS, where thread there will pick up the message and forward to destination socket. 1)each MS knows userId-> socket. 2)proxy know user-> MS 3) each socket has listening on
@tushargoel5522
@tushargoel5522 4 жыл бұрын
Hi 2 questions: 1) You said each process has 1 queue, typically whatsapp has 1M connection per server so do you think it's feasible to have that many queue? 2) What if before sending message server goes down. in that case queue also lost which causes our messages are lost as well? What are your thoughts?
@PABJEEGamer
@PABJEEGamer 3 жыл бұрын
Agreed. Ditributed message queue should be the way i believe. Creating a queue per message or user in the server definetly wont scale
@4324234fdsfds
@4324234fdsfds 4 жыл бұрын
Your videos are really great.. :) Delivered
@ayusharora2019
@ayusharora2019 3 жыл бұрын
I wish I could like the video twice or thrice. Super amazing. Taken bottom up approach. Reached complexity with simplicity.
@NeemiasJunior1
@NeemiasJunior1 4 жыл бұрын
Very good video, just a point that needs more attention is at 14:33 when you talk about threads and process inside the message service. Actually this is not strictly true, actually they use green threads inside the BEAM machine which are totally different and much more scalable than a real CPU thread per connection. For more info I would recommend the reading on en.wikipedia.org/wiki/Green_threads and en.wikipedia.org/wiki/C10k_problem
@anikpait5556
@anikpait5556 4 жыл бұрын
Great knowledgable explanation. Quick question: Why are we using a different connection HTTP server for media rather not the same connection?
@khalidelgazzar
@khalidelgazzar 4 жыл бұрын
Thank you. That's well explained and to the point
@FoodieNishi
@FoodieNishi 5 жыл бұрын
Thanks for the concise video, I like the accent.
@akshaygupta9625
@akshaygupta9625 4 жыл бұрын
Why there is a need for separate Http server to send images or audio files? Why can't we use the message server directly?
@ameyapatil1139
@ameyapatil1139 4 жыл бұрын
Hey Bro, thanks for excellent video. Have a small question - Is it scalable ( in terms of cost etc. ) to create a queue per user ? Eg: if 200 million users are online at same time on whastapp, there would be 200 million queues ?
@lyfzwrthlvngful
@lyfzwrthlvngful 3 жыл бұрын
That's what i thought as well. Instead of queue, we can just keep the last delivered message offset and maybe have some reference to find messages specific to receivers UID (with offset > stored offset) from the main messages datastore.
@naveengoyal9378
@naveengoyal9378 3 жыл бұрын
What if we use message queue system like Rabbit MQ or Kafka. And messaging system will process message from kafka stream and then server sends message to receiver. I am not feeling it a scalable system having 200 million queue existing in system.
@parryismful
@parryismful 5 жыл бұрын
Thanks Narenra for the very nice explanation. I have one doubt: Will creating separate process/thread for every active user will be a scalable design..?..At a time, millions of users can be online, so creating millions of thread/process can cause scalable issues, like lots of memory/CPU consumption...Please provide your input.
@ursypc
@ursypc 5 жыл бұрын
Not quite the processes but Actors. Search for Akka, Orleans.
@parryismful
@parryismful 5 жыл бұрын
Thanks @@ursypc . I will explore it definitely.
@kavithachellasamy2393
@kavithachellasamy2393 3 жыл бұрын
Thanks for the video. As u said, does the whatsApp stores the user along with last seen time in the table? For the million of users ? How does the chat history works? How does the whatsapp stores the user contacts in the table?
@kvsantosh
@kvsantosh 5 жыл бұрын
Hello Naren, Thanks a ton for the video. I have one question, considering the user base of WhatsApp (1B+), I don't think single load balancer can handle the load of so many connections. There must be multiple load balancers for example, one for each region etc. Could you please throw some light on this. Also, it would really help if you can discuss more on DB sizing. You mentioned WhatsApp manages to serve 10,000 users per messaging server node so there would be at least 100,000 messaging servers to handle 1billiion live users. What would be the design of DB to handle the load of 100,000 servers?
@TechDummiesNarendraL
@TechDummiesNarendraL 5 жыл бұрын
Actually whatsapp successfully handles upto 2Million connections per server (blog.whatsapp.com/196/1-million-is-so-2011)please recalculate the number of servers needed. and also when we say there are 1B live users we can optimize connections problem using GCM/APN to establish connections(lazy connect) only where there is a messages at the server!!
@davidscandurra560
@davidscandurra560 5 жыл бұрын
Yes do dns round Robin to first bl and then second level bl. Make sure that first level bl needs to be online 100% because how round Robin works. Google also uses de cix for example to directly pipe the request so their servers. I am 14 btw so I ahbw no idear about production
@gao2737
@gao2737 2 ай бұрын
when you saying 'a client connects to the messaging server', what do you mean by connecting to the server? Is it a state or websocket, what is the protocol or tech used here?
@mohitladia
@mohitladia 3 жыл бұрын
Great content!!
@kambalavijay6800
@kambalavijay6800 3 жыл бұрын
What in case client 1 and 2 are connected to different messaging server?
@bhashkarbelwal4116
@bhashkarbelwal4116 4 жыл бұрын
wow, thanks a lot for the clear explanation.
@brahmaiahkurapati6418
@brahmaiahkurapati6418 3 жыл бұрын
You have all knew companies application architecture let's build one company like that
@joelswapnilsingh5263
@joelswapnilsingh5263 3 жыл бұрын
Absolutely incredible!
@chirut4327
@chirut4327 9 ай бұрын
Create a new queue for each user? What is that queue? Is it something like SQS or RabbitMQ? Or is in-memory Queue? Creating a queue for each user itself sounds insane and impractical.
@AmolGautam
@AmolGautam 7 ай бұрын
rabbitMQ
@walaaelsayed8764
@walaaelsayed8764 4 жыл бұрын
Amazing and very simple explanation for such a complex system. I have a question about managing unique ID for every message for million different users. How could they do that? Thanks 😊
@TechDummiesNarendraL
@TechDummiesNarendraL 4 жыл бұрын
user_id + uuid ?
@08himanshu
@08himanshu 5 жыл бұрын
Hi Naren, One Doubt, If the thread of another user is on different messaging server, how the communication is happening between two nodes handling different connections of the same conversation. Sorry, if I am missing something
@ryandsouza9093
@ryandsouza9093 3 жыл бұрын
Why do we need a CDN? Doesn’t make sense because data is meant for specific set of users. WhatsApp only sends a placeholder for media and downloads when needed.
@bhupi316
@bhupi316 2 жыл бұрын
Can you please help in giving me high-level architecture for the following functional requirements? FR (Notification system): - send an email, SMS, in-app msgs - support all devices - mobile app, web app, tab, etc. - Get promo codes/audio confirmation messages (OTP on a call), media content (mp3, etc.) from exiting service/system, and use those promo codes to send. - expiration of a notification - recurring in nature - schedule a message Basically, I'm looking for a system design for the recurring scheduler.
@rajeshdansena
@rajeshdansena 5 жыл бұрын
You didn't talk about user base, I mean how can we scale for billions of user. May be you should talk about how and where to put cache. How can we vertically scale it. Appreciate for the video though :)
Redis system design | Distributed cache System design
34:10
Tech Dummies Narendra L
Рет қаралды 285 М.
NETFLIX System design | software architecture for netflix
51:26
Tech Dummies Narendra L
Рет қаралды 427 М.
Кадр сыртындағы қызықтар | Келінжан
00:16
Fortunately, Ultraman protects me  #shorts #ultraman #ultramantiga #liveaction
00:10
SCHOOLBOY. Последняя часть🤓
00:15
⚡️КАН АНДРЕЙ⚡️
Рет қаралды 12 МЛН
а ты любишь париться?
00:41
KATYA KLON LIFE
Рет қаралды 2,7 МЛН
Twitter system design | twitter Software architecture | twitter interview questions
36:56
WHATSAPP System Design: Chat Messaging Systems for Interviews
25:15
Gaurav Sen
Рет қаралды 1,8 МЛН
System Design : Design messaging/chat service like Facebook Messenger or Whatsapp
29:16
Tushar Roy - Coding Made Simple
Рет қаралды 351 М.
Basic System Design for Uber or Lyft | System Design Interview Prep
16:18
Paste bin system design | Software architecture for paste bin
31:20
Tech Dummies Narendra L
Рет қаралды 67 М.
Yelp system design | amazon interview question Yelp software architecture
57:31
Tech Dummies Narendra L
Рет қаралды 81 М.
How to Crack Any System Design Interview
8:19
ByteByteGo
Рет қаралды 368 М.
System Design Mock Interview: Design Facebook Messenger
14:50
Exponent
Рет қаралды 263 М.
Кадр сыртындағы қызықтар | Келінжан
00:16