20 ms·
According to @dang (https://news.ycombinator.com/item?id=28479595 https://news.ycombinator.com/item?id=28479595) via @sctb (https://news.ycombinator.com/item?id
by 5id 4y ago
According to @dang (https://news.ycombinator.com/item?id=28479595 https://news.ycombinator.com/item?id=28479595) via @sctb (https://news.ycombinator.com/item?id=16076041 https://news.ycombinator.com/item?id=16076041)
We’re recently running two machines (master and standby) at M5 Hosting. All of HN runs on a single box, nothing exotic:
CPU: Intel(R) Xeon(R) CPU E5-2637 v4 @ 3.50GHz (3500.07-MHz K8-class CPU)
FreeBSD/SMP: 2 package(s) x 4 core(s) x 2 hardware threads
Mirrored SSDs for data, mirrored magnetic for logs (UFS)
- likortera 4y agoNo microservices on top of kubernetes? no SPA with SSR? You are doing it wrong. I'm gonna write an alternative which will be WebScale. j/k of course.
- yodsanklai 4y ago(beginner question) How do they store the data? is an SQL db on overkill for such a use case? what would be the alternative? an ad-hoc filesystem based solution? then how do the two servers share the db? and is there redundancy at the db level? is it replicated somehow?
- krapp 4y agoData is stored in flat text files containing Arc Lisp tables, or in RAM. There is no 'database' per se, unless they've added one and not mentioned it. You can get the software and language HN is based on here: http://arclanguage.org http://arclanguage.org
- niclo 4y agoI think the link is broken, it's not HTTPS
- krapp 4y agoForce of habit, I fixed it.
- russelg 4y agoI love the design similarity to HN.
- CobaltFire 4y agoThat’s because HN is just about the only thing written in Arc, and everything else you see is a fork of an earlier version of HN.
- petercooper 4y ago"ad-hoc filesystem based solution" is the closest of your definitions, I think. Last time I saw/heard, HN was built in Arc, a Lisp dialect, and use(s/d) a variant of this (mirrored) code: https://github.com/wting/hackernews https://github.com/wting/hackernews Check out around this area of the code to see how simple it is. All just files and directories: https://github.com/wting/hackernews/blob/master/news.arc#L166 https://github.com/wting/hackernews/blob/master/news.arc#L16... .. the beauty of this simple approach is a lack of moving parts, and it's easy to slap Redis on top if you need caching or something. There is a modern maintained variant at https://github.com/arclanguage/anarki/tree/master/apps/news https://github.com/arclanguage/anarki/tree/master/apps/news as well if you want to spin up your own HN-a-like and have the patience. File syncing between machines is pretty much an easily solved problem. I don't know how they do it, but it could be something like https://syncthing.net/ https://syncthing.net/ or even some scripting with `rsync`. Heck, a cronned `tar | gzip | scp` might even be enough for an app whose data isn't exactly mission critical.
- scottwick 4y agoWow, I had no idea HN was built like that - I'm impressed. I really wish I could read the Arc code better though since I'd love to know more about the details of how data is represented on disk and when things move in and out of memory, etc. Does anyone know of other open source applications with similar architectures like this?
- krapp 4y ago>Does anyone know of other open source applications with similar architectures like this? There's a good reason everyone else just uses a relational database, and it isn't because everyone else is addicted to unnecessary complexity.
- justsomehnguy 4y ago> and it's easy to slap Redis on top if you need caching With filesystem as the storage you don't even need Redis, OS would cache the most recent files anyway.
- arnaudsm 4y agoWeird, I thought you needed 1024 Kubernetes nodes, a 70mb React bundle and 200 engineers to host 50M monthly sessions.
- manojlds 4y agoHN is not user friendly. Better comparison is Stack Exchange which is way more rich and runs on small (relative) infra.
- SMAAART 4y agohttps://stackexchange.com/performance https://stackexchange.com/performance
- arnaudsm 4y agoI agree HN could be improved with small CSS changes, but no backend change would be required.
- lm28469 4y agoWell the good thing with CSS is that you can override it with your own stuff locally if you wish to
- D13Fd 4y agoTougher to do on mobile though
- aaaaaaaaata 4y agoHow does anyone use anything aside from Materialistic?!
- frosted-flakes 4y agoTough to do when the entire layout is built with nested tables, like it's still 1999.
- atmosx 4y agoI wonder if they use something like CARP[^1] for redundancy. Also, strikes as odd that they didn't go with ZFS for storage, makes FS management _way_ easier for engineers who don't spent all their on these kind of operations. [^1]: https://www.freebsd.org/cgi/man.cgi?query=carp&sektion=4 https://www.freebsd.org/cgi/man.cgi?query=carp&sektion=4
- dsr_ 4y agoYou might ask what sort of filesystem maintenance they ever need to do. Replacing a disk is covered by the mirror. Backup is straightforward. The second system covers a lot more. If they need to increase hardware capacity, they can build new systems, copy in the background, and swap over with a few minutes of downtime.
- gigatexal 4y agoLove to see FreeBSD getting some love.
- seanw444 4y agoCurious how much memory usage it sits at on average.