logoalt Hacker News

withinboredomtoday at 7:55 AM7 repliesview on HN

My biggest issue with go is it’s incredibly unfair scheduler. No matter what load you have, P99 and especially P99.9 latency will be higher than any other language. The way that it steals work guarantees that requests “in the middle” will be served last.

It’s a problem that only go can solve, but that means giving up some of your speed that are currently handled immediately that shouldn’t be. So overall latency will go up and P99 will drop precipitously. Thus, they’ll probably never fix it.

If you have a system that requires predictable latency, go is not the right language for it.


Replies

mknyszektoday at 2:33 PM

> Thus, they’ll probably never fix it.

I'm sorry you had a bad experience with Go. What makes you say this? Have you filed an issue upstream yet? If not, I encourage you to do so. I can't promise it'll be fixed or delved into immediately, but filing detailed feedback like this is really helpful for prioritizing work.

melodyogonnatoday at 9:15 AM

> If you have a system that requires predictable latency, go is not the right language for it.

Having a garbage collector already make this the case, it is a known trade off.

show 1 reply
pjmlptoday at 8:33 AM

It misses having a custom scheduler option, like Java and .NET runtimes offer, unfortunely that is too many knobs for the usual Go approach to language design.

Having a interface for how it is supposed to behave, a runtime.SetScheduler() or something, but it won't happen.

red_admiraltoday at 7:58 AM

> If you have a system that requires predictable latency, go is not the right language for it.

I presume that's by design, to trade off against other things google designed it for?

show 1 reply
kjksftoday at 11:34 AM

> No matter what load you have, P99 and especially P99.9 latency will be higher than any other language

I strongly call BS on that.

Strong claim and evidence seems to be a hallucination in your own head.

There are several writeups of large backends ported from node/python/ruby to Go which resulted in dramatic speedups, including drop in P99 and P99.9 latencies by 10x

That's empirical evidence your claim is BS.

What exactly is so unfair about Go scheduler and what do you compare it to?

Node's lack of multi-threading?

Python's and Ruby's GIL?

Just leaving this to OS thread scheduler which, unlike Go, has no idea about i/o and therefore cannot optimize for it?

Apparently the source of your claim is https://github.com/php/frankenphp/pull/2016

Which is optimizing for a very specific micro-benchmark of hammering std-lib http server with concurrent request. Which is not what 99% of go servers need to handle. And is exercising way more than a scheduler. And is not benchmarking against any other language, so the sweeping statement about "higher than any other language" is literally baseless.

And you were able to make a change that trades throughput for P99 latency without changing the scheduler, which kind of shows it wasn't the scheduler but an interaction between a specific implementation of HTTP server and Go scheduler.

And there are other HTTP servers in Go that focus on speed. It's just 99.9% of Go servers don't need any of that because the baseline is 10x faster than python/ruby/javascript and on-par with Java or C#.

show 2 replies
pothamktoday at 11:37 AM

[dead]

desdenovatoday at 9:47 AM

> If you have a system, go is not the right language for it.

FTFY