Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

HN does not use a database?! Can you expand on that? It's very surprising to me.


I think the structure is very simple. It's just a lot of items like your comment is item 41207393 as in https://news.ycombinator.com/item?id=41207393

I think that is just written to disk as something like file41207393 when you click reply.

When the system needs an item it sees if it's cached in memeory and otherwise reads it from disk and I think that is pretty much the whole memory system. Some other stuff like user id that works in the same sort of way.


It just persists its in-memory data structures to disk. Here's the source of an old version; note uses of `diskvar` and `disktable`. A "table" here is just a hashtable.

https://github.com/wting/hackernews/blob/master/news.arc


if pg is still stuck in the 90s lisp, if bet it's just a single process with the site in ram, using make-object-persistent and loading as needed (kinda like python pickle).

that was all the rave for prototypes back then.


probably uses the filesystem as the backing store


Filesystems these days are like dbs


Good luck transactionally writing files to a random FS, but especially without access to native OS APIs.


What do you mean "without access to native OS API's"?

To be able to read and write you need native os apis, aka read() and write() otherwise how do you do it ?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: