开发者

Any Idea/guess of how twitter saves its tweets in the database and updates it real-time

I am making a twitter type of website (not as big as twitter:), but without using any twitter api), I have to decide what kind of database I should use and how to maintain it in consistent state.

The main problem: Suppose my website is a twitter clone(that will make my question easier to understand), if I have a user "A" has 100 friends and all his friends tweet something as the same time "A" logs in so at that point in t开发者_如何学Cime tweets will be fetched from database, but the database is being updated by his friends tweets => database is in inconsistent state

Q1> What would be the best solution to it? maintain 2 database, use multi-threading etc? Can anyone explain in detail.

Q2>What will be the best database for this particular usage.


Twitter uses a noSQL database called cassandra.
Take a closer look here: Apache Cassandra


when somebody writes in db table - the whole table itself is not locked, so others can write there concurrently. And read it. So user A will receive all that others had time to wrote (if their transactions committed successfully). So there I don't see here any inconsistency

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜