4 ms·
Flat files are very fast. The OS caches the files most of the time in memory. OS caching only becomes a problem when the hot data exceeds the memory. By the
by ww520 11y ago
Flat files are very fast. The OS caches the files most of the time in memory. OS caching only becomes a problem when the hot data exceeds the memory.
By the nature of HN, there isn't that much hot data. Only the couple dozens of links in the HN front page are popular. May be couple hundreds or couple thousands people actively voting. All those don't take too much space and can fit in memory comfortably so the entire data set can be operated inside memory essentially.
The front page has 30 articles. Assuming 100k per one yields 3MB. It has about 1000 vote points. Assuming 50 bytes per vote, it's about 50k. So you can fit the entire front page data in under 4MB. That's tiny amount of data to work with.