Ask HN: How often does HN recalculate rankings?
The HN ranking algorithm is well-known (see: http://amix.dk/blog/post/19574). My question is: is the rank of every single post updated at some interval? It would seem that, in some way, this has to happen, otherwise items that are growing obsolete (on account of the gravity of time) would not move down as they should. However, it also seems impractical and prohibitively costly to constantly re-rank every single item. Is the idea that time has such a gravitational effect that HN only needs to fetch all posts where the timestamp is < 2 weeks ago (or whatever) and re-rank only THOSE items since the ranking of a post submitted 2 weeks ago and one submitted 2 months ago will both be approaching zero (thereby limiting reranking to only a small subset of all posts)?
(
6 comments
| 17 points
| on HN
)
You might expect that every time you visit Hacker News, the stories are scored by the above formula and sorted to determine their rankings. But for efficiency, stories are individually reranked only occasionally. When a story is upvoted, it is reranked and moved up or down the list to its appropriate spot, leaving the other stories unchanged. Thus, the amount of reranking is significantly reduced. There is, however, the possibility that a story stops getting votes and ends up stuck in a high position. To avoid this, every 30 seconds one of the top 50 stories is randomly selected and reranked. The consequence is that a story may be "wrongly" ranked for many minutes if it isn't getting votes. In addition, pages can be cached for 90 seconds.