News for hackers. Stuff that matters.
Re:This shouldn't have happened: A vulnerability postmortem by fleventynine on Wednesday December 01, 2021 @05:56PM (#29410228)
If it can really guarantee single-digit microsecond pauses in my realtime thread no matter what happens in other threads of my application, that is indeed a game changer. But I'll believe it when I see it with my own eyes. I've never even used a garbage collector that can guarantee single-digit millisecond pauses.
Re:This shouldn't have happened: A vulnerability postmortem by titzer on Wednesday December 01, 2021 @11:06PM (#29412460)
Have you measured the pause times of free()? Because they are not deterministic, and I have met few people who understand in detail how complex it can be in practice. In the limit, free() can be as bad as GC pause times because of chained deallocation--i.e. not statically bounded.
Re:This shouldn't have happened: A vulnerability postmortem by gpderetta on Thursday December 02, 2021 @03:26AM (#29413762)
People don't call free from their realtime threads.
Re:This shouldn't have happened: A vulnerability postmortem by alophawen on Thursday December 02, 2021 @02:36AM (#29413506)
This is true, but for performance's sake, you should not alloc/free in a busy loop, especially not on a real time system.

Allocate in advance, reuse allocated memory.

Re:This shouldn't have happened: A vulnerability postmortem by titzer on Monday December 06, 2021 @08:54AM (#29459733)
> Allocate in advance, reuse allocated memory.

In practice, almost all real-time systems use this strategy, even going so far as to allocate all memory at compile time. The first versions of Virgil (I and II) used this strategy and compiled to C.

When doing this, the whole debate of memory safe (automatic) vs unsafe (manual) is completely orthogonal.

Re:This shouldn't have happened: A vulnerability postmortem by cozzyd on Thursday December 02, 2021 @12:58AM (#29413016)
But you can generally control when free is called.
Re:This shouldn't have happened: A vulnerability postmortem by dpifke on Wednesday December 01, 2021 @07:16PM (#29410938)
Not sure current state of the art, but Go's worst-case pause time five years ago was 100µs: https://groups.google.com/g/golang-dev/c/Ab1sFeoZg_8
Re:This shouldn't have happened: A vulnerability postmortem by elabajaba on Wednesday December 01, 2021 @10:15PM (#29412116)
Discord was consistently seeing pauses in the range of several hundred ms every 2 minutes a couple years ago.

https://blog.discord.com/why-discord-is-switching-from-go-to...

Re:This shouldn't have happened: A vulnerability postmortem by terinjokes on Thursday December 02, 2021 @01:33AM (#29413177)
Hard to say without more details, but those graphs look very similar to nproc numbers of goroutines interacting with the Linux-of-the-time's CFS CPU scheduler. I've seen significant to entire improvement to latency graphs simply by setting GOMAXPROC to account for the CFS behavior. Unfortunately the blog post doesn't even make a passing mention to this.
Re:This shouldn't have happened: A vulnerability postmortem by randomswede on Thursday December 02, 2021 @03:10AM (#29413677)
Anecdotally, the main slowdown we saw of Go code running in Kubernetes at my previous job was not "GC stalls", but "CFS throttling". By default[1], the runtime will set GOMACSPROCS to the number of cores on the machine, not the CPU allocation for the cgroup that the container runs in. When you hand out 1 core, on a 96-core machine, bad things happen. Well, you end up with a non-smooth progress. Setting GOMACPROCS to ceil(cpu allocation) alleviated a LOT of problems

Similar problems with certain versions of Java and C#[1]. Java was exacerbated by a tendency for Java to make everything wake up in certain situations, so you could get to a point where the runtime was dominated by CFS throttling, with occasional work being done.

I did some experiments with a roughly 100 Hz increment of a prometheus counter metric, and with a GOMAXPROCS of 1, the rate was steady at ~100 Hz down to a CPU allocation of about 520 millicores, then dropping off (~80 Hz down to about 410 millicores, ~60 hz down to about 305 millicores, then I stopped doing test runs).

[1] This MAY have changed, this was a while and multiple versions of the compiler/runtime ago. I know that C# had a runtime release sometime in 2020 that should've improved things and I think Java now also does the right thing when in a cgroup.

Re:This shouldn't have happened: A vulnerability postmortem by terinjokes on Thursday December 02, 2021 @11:46AM (#29418568)
AFAIK, it hasn't changed, this exact situation with cgroups is still something I have to tell fellow developers about. Some of them have started using [automaxprocs] to automatically detect and set.

[automaxprocs]: https://github.com/uber-go/automaxprocs

Re:This shouldn't have happened: A vulnerability postmortem by randomswede on Friday December 03, 2021 @02:22AM (#29427493)
Ah, note, said program also had one goroutine trying the stupidest-possible way of finidng primes in one goroutine (then not actyakly doing anything with the found primes, apart from appending them to a slice). It literally trial-divided (well, modded) all numbers between 2 and isqrt(n) to see if it was a multiple. Not designed to be clever, explicitly designed to suck about one core.
Re:This shouldn't have happened: A vulnerability postmortem by pbohun on Wednesday December 01, 2021 @09:59PM (#29411998)
I found this go.dev blog entry from 2018. It looks like the average pause time they were able to achieve was significantly less than 1ms back then.

"The SLO whisper number here is around 100-200 microseconds and we will push towards that. If you see anything over a couple hundred microseconds then we really want to talk to you.."

https://go.dev/blog/ismmkeynote

Re:This shouldn't have happened: A vulnerability postmortem by syntheticcorp on Wednesday December 01, 2021 @06:32PM (#29410513)
I believe Java’s ZGC has max pause times of a few milliseconds
Re:This shouldn't have happened: A vulnerability postmortem by dralley on Wednesday December 01, 2021 @07:10PM (#29410871)
Shenandoah is in the the same latency category as well. I haven't seen recent numbers but a few years ago it was a little better latency but a little worse throughput.