How do Reddit, Lemmy, Tildes, etc. process, store, and serve ranked threads/links?

switchgear
Fri, 07 Jul 2023 12:12:01 +0000

I'm familiar with how the ranking algorithms work on a high level. What I'm curious about is to how those algorithms are actually applied.

How do these platforms actually apply the ranking algorithms so that the user sees the threads appropriately ordered? My knowledge is limited to PHP and MySQL, so I'm looking at it through the lense of those systems. I've thought of a few possible ways, but all of them seem pretty resource intensive.

1. Maintain a table of threads with all relevant information required to calculate ranking, as well as ranking itself. A server side script executing on a routine basis every X minutes (cron job?) updates the rankings on all the threads, so they can be easily ordered. However, people most likely don't care about threads >Y days old, so those can be excluded or automatically deranked somehow.

2. Maintain a table of threads with all relevant information required to calculate ranking. When a user visits, the last X threads (again, users probably don't care about really old stuff) are pulled out of the database and ran through a ranking and sorting algorithm, reordered and displayed to the user. This seems the most resource intensive?

I am by no means a professional developer, but I've been dabbling recently and the concept of how these large quantities of data are ranked both perplexes and interests me.

Comments URL: https://tildes.net/~comp/17pe/how_do_reddit_lemmy_tildes_etc_process_store_and_serve_ranked_threads_links

Votes: 15

Comments: 8