P
P
phantomite2014-10-02 10:15:55
SQL
phantomite, 2014-10-02 10:15:55

How was the selection of news in contact or on Facebook made?

How do sites like contact show the latest K news? And how is this data cached? Interested in architecture.
SELECT * FROM Posts where post_author in(SELECT friend_id FROM Users WHERE friend_id = '..') ORDER BY Date Limit 100
If you can offer a solution with NoSQL, it will also be very interesting.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alex Chistyakov, 2014-10-02
@alexclear

The main rule of operation of such systems is the observance of data locality. The second rule is "one page - one SQL query" (this is if there is SQL in the system at all). If you think about it for a long time, you can come to the conclusion that both of these requirements are quite logical. This means that the latest K news, as well as all the information presented on the user's page, must be stored with the user in order to get it in one request. Whether it's SQL or NoSQL, it doesn't really matter. This data is cached in memory in a specialized cache (made, for example, on Redis). The news is updated, of course, asynchronously using queue servers and special update services running in the background.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question