TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: How is HN's ranking algorithm implemented?

2 pointsby jgannonjrabout 13 years ago
There is an older article from a post about a year and a half ago titled "How Hacker News Ranking Algorithm Works" (http://news.ycombinator.com/item?id=1781013). I understand how the algorithm works mathematically but how is it implemented on the server? More specifically, how does the server keep its rankings updated if each stories rank decays as a function of the time since submission? The ranks must be getting continuously calculated at some point, but I'm not sure when that would be--it doesn't make sense to calculate them on request, and there are way too many stories to be constantly processing all of them all the time. My thought is that the rank is recalculated after each vote, and there must also be some rank threshold at which a story's rank is automatically processed and recalculated continuously in the background, this way the recent stories are constantly being processed while older ones past the threshold become stale and are ignored. This could also be why there is no real pagination (instead the next url is /x/fnid=xxxxxxxxxx), possibly to discourage people from going too deep. I could also be completely wrong. Can anyone shed some light on this?

2 comments

cd34about 13 years ago
<a href="http://arclanguage.com/install" rel="nofollow">http://arclanguage.com/install</a><p>contains the source code less some of the secret bits and bytes.
评论 #3747460 未加载
_3ex7about 13 years ago
Just by observing, I think it goes like this:<p><pre><code> if linked_article.is_relevant_to_YC_company(): goto front_page; elsif linked_article.is_negative_to_YC_company(): linked_article.dead();</code></pre>