Re:Ask HN: How does the HN "More" link work?
by jgrahamc on Monday December 10, 2012 @11:45AM
(#4899884)
The fnid is the ID of a function.
The Hacker News code keeps a table of anonymous functions (see the fn (req) definition there) that can be run later to generate a page. The fnid is the unique ID of that function (which is generated randomly)
So, when you hit a URL with a fnid in it the fnid is looked up in the fns* table and the function executed to produce the page. There's a reaper function that deletes fnids that are older than a timeout value (which is how you got the Expired Link error.
[ Parent
| on HN ]
Re:Ask HN: How does the HN "More" link work?
by kellros on Monday December 10, 2012 @11:54AM
(#4899948)
So the fnid is essentially a caching mechanism for pre-rendered web pages linked to a point in time? That's pretty neat and simple fitting in perfectly with the simplistic design of HN (not confusing simplistic with basic, instead a reference to the design paradigm).
Re:Ask HN: How does the HN "More" link work?
by brudgers on Monday December 10, 2012 @12:33PM
(#4900351)
My understanding is that pre-rendered web pages are not involved. What is "cached" is a function whose output is a particular webpage rendered on the fly so that "flag/unflag," current score and number of comments can be kept up to date.
In other words, the function fetches a particular group of articles along with the current information about them and generates the page. Some of those articles were known at the time the function was generated. Some of the articles are new or have undergone a significant change in status since the function was generated - I suspect these incur greater overhead.
At a certain point, the number of changes are are large enough that it is more efficient to generate a new function.
Re:Ask HN: How does the HN "More" link work?
by zupreme on Monday December 10, 2012 @12:21PM
(#4900249)
Thanks for this very detailed response. Is the same FNID shown for all visitors during the FNID's applicable period, or is it individualized or region-specific?
Essentially I'm asking if all of us see the same stuff at the same time.