Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How would you design a twitter like message system, how to design the messaging system? [closed]

Tags:

java

twitter

If you were to create an application like twitter, how would you go about designing the messaging system?

Specifically look for ideas on the basic data model, and how you would write the method that takes the user's tweet and then sends it out to all its followers?

example:

Tweets ( tweetID, userID, message, datesend)
User (userID, ...)
Followers(userID, followerUserID)

Inbox(userID, tweetID)

is the above model a good starting point?

Would you first insert the tweet, then push a message to the queue. Then one-by-one, take a message off the queue and push the message to its subscribers?

(I am ignoring the mobile functionality of twitter, just focussing on the web based functionality, but I thought of using a queue from the start so one could add other functionality later)

like image 806
user275475 Avatar asked Feb 22 '10 15:02

user275475


People also ask

How does Twitter system work?

Twitter handles thousands of tweets per second so you can't have just one big system or table to handle all the data so it should be handled through a distributed approach. Twitter uses the strategy scatter and gather where it set up the multiple servers or data center which allow indexing.

What is the architecture of Twitter?

Architecture of Twitter database server [16]. For storage purpose, Twitter uses MySQL and Cassandra that are accessed by various services through Thrift where the FlockDB storage solution built on top of MySQL was used to store relationships between users and followers/friends.


1 Answers

The High Scalability blog has a number of articles on twitter and it's infrastructure and changes over time that might interest you.

like image 181
matt b Avatar answered Sep 23 '22 17:09

matt b