0% completed
Designing Facebook Messenger
1. What is Facebook Messenger?
Facebook Messenger is a software application that provides text-based instant messaging services to its users. Messenger users can chat with their Facebook friends both from cell phones and Facebook’s website.
Try it yourself
Before looking at the solution, try designing it:
Designing Messenger (video)
Here is a video discussing how to design Facebook Messenger:
2. Requirements and Goals of the System
Our Messenger should meet the following requirements:
Functional Requirements:
1
.....
.....
.....
Manoj Dixit
· 2 years ago
Not talking about Data Model, System design, It's all talk
arun
· 4 years ago
The portion about the cache servers has no explanation other than that we would need a load balancer to our cache servers.
If there are cache servers, then the assumption must be that these servers are faster to get to somehow then going against the persistent store or the database. In that case what do we do to maintain cache coherency ? are the writes happening from the cache servers? It would be nice to flesh out this portion of the design instead of some high level diagram that plops these boxes called cache servers.
Naveen Marikar
· 3 years ago
Both these are not discussed in this topic I believe. Thoughts?
Junaid Effendi
· 4 years ago
For data partitioning, why not use consistent hashing, doing % 1000 means if its get imbalance then we need to readjust?
Benoit Descamps
· 4 years ago
In Facebook Messenger, regarding the question: How does the messenger maintain the sequencing of the messages?
Is the method described analogous to consistent prefix read? see https://www.microsoft.com/en-us/research/publication/replicated-data-consistency-explained-through-baseball/?from=http%3A%2F%2Fresearch.microsoft.com%2Fpubs%2F157411%2Fconsistencyandbaseballreport.pdf
HelloWorld
· 4 years ago
A modern server can handle way more than 50k open concurrent connections (websockets) for pushing messages. We don't need 10k servers for handling this.
nth learner
· 5 years ago
Question about Data partitioning - Not sure if there are some users who are very active and sending a lot of data, so was wondering if it is useful to partition on the basis of conversation id - a hash constructed from the combination of sender id and received id? That way all messages that belongs to a conversation can be fetched all at once and a user's conversations can be stored on multiple shards. Not sure what is the downside of that except all of the data needs to be accessed at once at the time of list of chats that shows the previews. That can make it slow. Also, as the article says that we will be keeping two copies - a sender and a receiver's copy of the messages - so maybe, we also need to keep two copies but isn't that we'll be keeping in case of partition based on UserID.
Se
Kailas Lokhande
· 4 years ago
https://www.youtube.com/watch?v=zKPNUMkwOJE&t=1511s is complimentary for messenger design, answers few un-answered questions.
Chandan Gurjar
· 4 years ago
you say "How do we know which server holds the connection to which user? We can introduce a software load balancer in front of our chat servers; that can map each UserID to a server to redirect the request."
Lets say there are 10 thousand users , how can we configure the reverse proxy to map these users to the chat server? Would it not be cumbersome? Will not the laoad balancer need to maintain these user info anywhere?
wilchang
· 3 years ago
Why is it more important to see all the same messages on all devices vs having the service be highly available? Is it a better experience to not have access to chat and potentially have it be slow due to consensus quorum, which is in contrast w/ the low latency NFR, or have it truly be low latency and highly available and be out of date but eventually be consistent after some X time?