News for hackers. Stuff that matters.
Re:Ask HN: Is HN having problem keeping up today? by nicoburns on Monday October 04, 2021 @02:46PM (#28750609)
I rather suspect that it's because of the Facebook outage, but indirectly. HN is always slow when major tech services (Facebook, Google, AWS, Github, Slack, Fastly, Cloudflare, etc) services are down. The HN community seems to congregate here for updates causing higher than usual traffic.
Re:Ask HN: Is HN having problem keeping up today? by nafizh on Monday October 04, 2021 @03:36PM (#28751101)
That's what I thought but now Twitter is having problem loading replies to a tweet. I think it's something more general rather than FB centric.
Re:Ask HN: Is HN having problem keeping up today? by nicoburns on Monday October 04, 2021 @03:45PM (#28751185)
Apparently DNS services are getting hammered with much higher traffic than usual for Facebook domains (as FB DNS is down so millions of devices are continually retrying the lookup).

For twitter specifically, I also wouldn't be surprised if a non-trivial number of people have increased their use of twitter while facebook is down.

Re:Ask HN: Is HN having problem keeping up today? by raelmiu on Monday October 04, 2021 @03:57PM (#28751313)
That’s really interesting. Where did you find that info?
Re:Ask HN: Is HN having problem keeping up today? by jonah on Monday October 04, 2021 @04:17PM (#28751527)
"hello literally everyone" --@twitter

https://twitter.com/Twitter/status/1445078208190291973

Re:Ask HN: Is HN having problem keeping up today? by edoceo on Monday October 04, 2021 @04:40PM (#28751803)
WhatsApp in the replies like "hi". I hate the internet.
Re:Ask HN: Is HN having problem keeping up today? by simonklitj on Monday October 04, 2021 @05:08PM (#28752104)
I at least like what Instagram commented! https://twitter.com/instagram/status/1445084977096314880
Re:Ask HN: Is HN having problem keeping up today? by jfrunyon on Monday October 04, 2021 @04:17PM (#28751530)
The DNS hammering bit was posted by Cloudflare CTO on Twitter. https://twitter.com/jgrahamc/status/1445066136547217413
Re:Ask HN: Is HN having problem keeping up today? by rrrrrrrrrrrryan on Monday October 04, 2021 @04:23PM (#28751607)
Re:Ask HN: Is HN having problem keeping up today? by croshan on Monday October 04, 2021 @03:56PM (#28751298)
> FB/IG is down, browse Twitter

> Twitter starts to fail under load

I think it's only natural, given they're the biggest social networks. I'd guess they have significant overlap.

Re:Ask HN: Is HN having problem keeping up today? by asddubs on Monday October 04, 2021 @03:28PM (#28750993)
plus HN has been a bit spotty as of late anyway
Re:Ask HN: Is HN having problem keeping up today? by unethical_ban on Monday October 04, 2021 @03:35PM (#28751089)
Either there is a massive number of HN users F5ing the homepage for the last few hours, HN is woefully unprepared for surges in traffic, or there is some kind of outage with their infrastructure.

hnstatus on twitter and hund.io show no outage news.

Re:Ask HN: Is HN having problem keeping up today? by oneeyedpigeon on Monday October 04, 2021 @03:38PM (#28751115)
> a massive number of HN users

It'll be this, I'd bet money on it. Lots like me who don't visit every day are coming to HN for more info. This site probably only ever sees a tiny percentage of its registered users accessing at once; right now, it'll be a much larger percent.

Re:Ask HN: Is HN having problem keeping up today? by hinfaits on Monday October 04, 2021 @04:35PM (#28751748)
I am one of the many that only goes to HN when a major service appears down (usually AWS)
Re:Ask HN: Is HN having problem keeping up today? by nicoburns on Monday October 04, 2021 @03:57PM (#28751311)
IIRC HN runs on a single server. So they don't really put much effort into scaling to higher traffic levels. They don't really need to. Even now the site is available, if a little slow.
Re:Ask HN: Is HN having problem keeping up today? by prirai on Monday October 04, 2021 @04:15PM (#28751510)
Yep and that's great. Whole of Fediverse, Matrix, IRC, Telegram works just fine. Lesson: Never depend on a centralized server.
Re:Ask HN: Is HN having problem keeping up today? by joecool1029 on Monday October 04, 2021 @04:24PM (#28751622)
Telegram is buckling under this too. Only major comms for me not slowing down at the moment are Fastmail (email) and Matrix (which we have the homeserver on our own ASN)
Re:Ask HN: Is HN having problem keeping up today? by BoxOfRain on Monday October 04, 2021 @05:17PM (#28752186)
Discord is working for me, at least the text is.
Re:Ask HN: Is HN having problem keeping up today? by Dylan16807 on Monday October 04, 2021 @07:13PM (#28753575)
The underlying problem is that HN is near the limit of its hardware all the time, which could happen on one server or on 200 servers. And the reason it's near the limit is because it's single-threaded, I believe. Fix it to use multiple threads, and one centralized server will handle load spikes like this just fine.
Re:Ask HN: Is HN having problem keeping up today? by klibertp on Monday October 04, 2021 @09:07PM (#28754384)
Nginx is single-threaded. At least was when I last looked.

Node.js similarly is single-threaded. Both boast pretty impressive performance.

Being single-threaded is not a detriment to performance, rather, it most often results in faster software, per core, due to lack of the need for synchronization and avoiding a memory allocation that happens for each thread (can be a problem, see C10K problem).

Being single-threaded does not mean you can't do things concurrently. As long as you have a set of async primitives, starting with the venerable select(2), and a bit of language syntactic sugar (preferably, or just setjmp(3)) you can interleave handling of incoming and outgoing data in what is called "cooperative multitasking". There are many higher level frameworks built on top of the principle, which is that - hidden or visible - context switches are voluntary only. As HN seems to be written in Arc, which shares the implementation with Racket, then the feature most likely to be used for this is either call/cc (or one of the higher-level abstractions built upon it, like generators) or it would, going past the "cooperative" territory, simply use threads: https://docs.racket-lang.org/reference/threads.html These threads are not "real" threads, only one instruction among all threads ever executes at once, but the points of context switching are not specified in the code being executed (leading to preemptive multitasking but without parallelism). If HN uses those, then it can be called both "single-threaded" (the VM) and "multi-threaded" (the HN code) at the same time.

Being single-threaded also doesn't prevent you from using multiple cores to max out your processing power. In age old tradition you can just spawn off a few worker processes and call it a day. You might need some sort of Inter-Process Communication, but there are many mechanisms to choose from. Nowadays on Linux you can use the listening socket as a simple round-robin scheduler for processes, free of charge, no need for a separate proxy. The processes might be managed by external supervisor, like systemd, or they might be managed by the language runtime itself, and Racket provides Places for this IIRC: https://docs.racket-lang.org/reference/places.html

Note: I'm just guessing based on what I've heard about HN implementation and my knowledge of Racket which may, or may not, be relevant at this point.

Anyway: rewriting the HN backend to "use multiple OS-level, preemptively scheduled threads" (which you wanted to write but contracted to "multiple threads"), would not result in per-core performance increase, it's actually more probable to cause the exact opposite. I'd guess that the backend is already optimized in terms of algorithms and data storage, so the only recourse now would be to rewrite the whole thing in (or compile down to) a language that tends to perform better than what Racket VM can offer. Given that HN is already a weekend project of a hacker (I mean, written in a Lisp? A Lisp implemented on (former) Scheme...), I'd probably give Nginx + LuaJIT a whirl, or maybe one of the BEAM languages (there's a Lisp over there, too, so another fun weekend for porting Arc to LFE) if manual control over distribution over multiple nodes is desirable (but it would be a total time-sink, while things like Kubernetes (I'm told) mostly work well enough... though K8s is a time-sink in its own right...)

Dang mentioned in another comment the GC being too slow. In that case, replacing the GC implementation could help, if possible. It's also possible to write code that avoids as many allocations as possible, but it's hard, and the GC can still happen at bad moments. In some cases, simply disabling the GC altogether and restarting the process periodically can also give better - or at least more predictable - performance. This is indeed a troubling problem to have, but it's completely orthogonal to single- or multi-thrededness. (Other than the multi-threding tends to allocate more memory for the same workload)

So yeah, that was a tangent, but your statement was very wrong, yet very common, so I thought I'd do my duty as a good techie and shed some light on the matter.

Re:Ask HN: Is HN having problem keeping up today? by Dylan16807 on Monday October 04, 2021 @09:42PM (#28754604)
That's a lot of words to complain that I didn't explicitly say "and single-process".

My statement isn't "very wrong" at all. If you actually have one single thread, total, that's a harsh limit on how much you can do. And I never implied it wasn't concurrent within that thread.

Re:Ask HN: Is HN having problem keeping up today? by klibertp on Monday October 04, 2021 @10:03PM (#28754731)
That's still wrong: scheduling and synchronisation take time, especially synchronization, which has both an overhead and introduces uncertainty in when the lock will be released. As I said, multi-threading results in worse per core performance, and depending on your data it might actually even perform worse on multiple cores (sometimes; most often it offers a moderate speed-up, not what you'd expect).

You also presented the threadedness as a cure-all solution to performance problems, which it is not. That's wrong.

You also never implied that you mean paralelism in general as opposed to just threads. But yeah, in the case you can't use any kind of parallelism, you're kind of screwed. The problem is that threads are one of the worst ways of introducing parallelism.

Re:Ask HN: Is HN having problem keeping up today? by Dylan16807 on Monday October 04, 2021 @11:57PM (#28755345)
> That's still wrong: scheduling and synchronisation take time, especially synchronization, which has both an overhead and introduces uncertainty in when the lock will be released.

No matter your method, you need some kind of scheduling and synchronization if you want to go beyond 5 billion CPU cycles per second on a multi-user site.

> You also presented the threadedness as a cure-all solution to performance problems, which it is not. That's wrong.

No I didn't. But having more than one core in use is the only way to get over a certain threshold, no matter how good your code is.

> The problem is that threads are one of the worst ways of introducing parallelism.

Like I said, it would have been better if I was clearer that I mean completely non-parallel code. But parallelism was my point. Everything you're saying about threads in a single process vs. multiple processes is not me being wrong, because it wasn't my argument.

Or to put it another way: Yes threads in a single process are on the bad end of parallelism. But they're also the easiest. If you see a statement that code can't even do that, then that should already imply that you can't run multiple processes on the same website instance.

Re:Ask HN: Is HN having problem keeping up today? by klibertp on Tuesday October 05, 2021 @01:36PM (#28762715)
Ok, let's chalk it up as a miscommunication for the most part, I'm sorry for calling your comment "very wrong". We can agree that it was incomplete/imprecise, right? It got explained, so let's move on :) But, I take issue with one more bit here:

> But they're also the easiest.

I don't believe that's true. Threads are the easiest to work with if you have a lot of shared, mutable state kept within an adress space of a single process and, crucially, cannot do anything about it. I don't know if that's the case for HN backend, but it rarely is in practice. Then there's a problem of multiple different threading implementations out there, and also an issue of how the threading mechanisms interact with the runtime (Python is multithreaded, but has a GIL). Frankly, it's a minefield on all sides, and implementing a system that is multithreaded, performant, and correct at the same time is the exact opposite of what I'd call "easy". That's also the reason why I disagree here:

> If you see a statement that code can't even do that, then that should already imply that you can't run multiple processes

To me, threads are not the first thing that comes to mind when I think about parallelism. Being unable to leverage threads, to me, is a good thing: just let this sleeping can of worms lie. As you know, there are multiple (many) ways of achieving parallelism, and they differ very much: I don't think being unable to leverage one of them says anything about the ability to use any of the others. That may be just me, though, so let's just say I have a different impression here and call it a day :)

Re:Ask HN: Is HN having problem keeping up today? by Dylan16807 on Tuesday October 05, 2021 @08:00PM (#28767372)
Sure, very little to disagree with, and moving on is fine, but I do want to make one small note: the reason I say threads are easier is that in almost every case you can take a multi-process model and turn it into an efficient multi-thread model with minimal effort. Threads give you more tools, and a lot of those tools are slow. And if a type of parallelism won't work with threads, it very likely won't work with anything else.
Re:Ask HN: Is HN having problem keeping up today? by ufmace on Monday October 04, 2021 @05:15PM (#28752173)
Seems like the opposite lesson to me - Telegram is kind of iffy, not sure about the others. The only thing that's been really solid today is Google. So I guess depend on multiple enormous centralized services?
Re:Ask HN: Is HN having problem keeping up today? by suyash on Monday October 04, 2021 @02:57PM (#28750698)
or it could be a malicious attack? I doubt most facebook users even know what HN is.
Re:Ask HN: Is HN having problem keeping up today? by flutas on Monday October 04, 2021 @03:01PM (#28750728)
> The HN community seems to congregate here for updates causing higher than usual traffic.

IMO it's probably a lot of us tech workers watching in awe of what's going on when a big tech company craps itself.

Re:Ask HN: Is HN having problem keeping up today? by rplnt on Monday October 04, 2021 @03:09PM (#28750759)
But all HN users know what Facebook is. And outage of this scale is rare and interesting.
Re:Ask HN: Is HN having problem keeping up today? by tuke on Monday October 04, 2021 @03:18PM (#28750873)
What is Facebook?
Re:Ask HN: Is HN having problem keeping up today? by ed_elliott_asc on Monday October 04, 2021 @03:24PM (#28750937)
The beginning of the end of humanity
Re:Ask HN: Is HN having problem keeping up today? by peakaboo on Monday October 04, 2021 @03:31PM (#28751037)
Its a daycare center for young adults. They grow up eventually.
Re:Ask HN: Is HN having problem keeping up today? by ChrisMarshallNY on Monday October 04, 2021 @04:00PM (#28751347)
> Its a daycare center for young adults.

Actually, my experience with FB (I have an account, but don't spend much time, there), is that it is packed with grayhairs, like me.

I think the younger folks have other venues they frequent.

Re:Ask HN: Is HN having problem keeping up today? by 130e13a on Monday October 04, 2021 @04:16PM (#28751522)
This is definitely the correct take. I fall into the 18-24 demographic and I don't think I've used Facebook at all in the past 3-4 years. Neither does anyone else I know who is my age.

This is essentially a reverse network effect: because so few young people are on the platform, few other young people see a reason to use it.

Re:Ask HN: Is HN having problem keeping up today? by tapas73 on Monday October 04, 2021 @04:49PM (#28751907)
Also when parents and grandparents join, kids start to leave.
Re:Ask HN: Is HN having problem keeping up today? by aabbcc1241 on Monday October 04, 2021 @08:57PM (#28754321)
Interesting relationship
Re:Ask HN: Is HN having problem keeping up today? by ChrisMarshallNY on Tuesday October 05, 2021 @06:40AM (#28757615)
In the US, at least, this is definitely the case.

We like to throw anyone over 40 into the skip (especially in the tech industry).

It has caused some issues.

Re:Ask HN: Is HN having problem keeping up today? by jen20 on Monday October 04, 2021 @11:16PM (#28755141)
Are we talking the company or the user base here?
Re:Ask HN: Is HN having problem keeping up today? by ChrisMarshallNY on Tuesday October 05, 2021 @05:21AM (#28757058)
Good point.

The company does have a fairly young, highly-paid, workforce.

I assumed the user base.

Re:Ask HN: Is HN having problem keeping up today? by gkoberger on Monday October 04, 2021 @03:05PM (#28750732)
No, but most HN users know what Facebook (and WhatsApp and Instagram) are.

That being said, I've seen theories that certain non-FB sites are slow just because DNS lookups are so backed up.

Re:Ask HN: Is HN having problem keeping up today? by nottorp on Monday October 04, 2021 @04:08PM (#28751431)
DNS lookups are certainly slower for random sites. I just opened an about zero traffic site that i hadn't gone to in a while (so dns not cached). It took a while (10 seconds?) to load the first time. Insta load the second time.

This seems to happen for .com but not other TLDs so maybe .com is getting hammered?

Re:Ask HN: Is HN having problem keeping up today? by blendergeek on Monday October 04, 2021 @03:21PM (#28750897)
> That being said, I've seen theories that certain non-FB sites are slow just because DNS lookups are so backed up.

I have been getting a Hacker News error message more often then usual today. So I don't think it is just DNS.

Re:Ask HN: Is HN having problem keeping up today? by shadowgovt on Monday October 04, 2021 @03:18PM (#28750866)
Most Facebook users don't know what HN is, but most HN users have Facebook accounts and will migrate here for the dopamine-inducing refresh clicks (don't let them try to claim otherwise ;) ).

If most Facebook users knew what HN was and congregated here when FB was down, the site would be utterly crushed.

Re:Ask HN: Is HN having problem keeping up today? by djmips on Monday October 04, 2021 @03:00PM (#28750717)
It doesn't have to be 'most' facebook users.