6 ms·
This looks like what people have been doing with Java for years, except worse because Go lacks tuning. A common approach with Java is to bootstrap your service
by staticassertion 5y ago
This looks like what people have been doing with Java for years, except worse because Go lacks tuning. A common approach with Java is to bootstrap your service with a maxheap based on the environment.
https://eng.uber.com/jvm-tuning-garbage-collection/ https://eng.uber.com/jvm-tuning-garbage-collection/
Here's another blog from Uber on JVM tuning.
Some notes:
1. They have options
2. They have a powerful gc log, no need to roll your own finalizer thing like this
3. Choosing the max heap size, which seems like what they actually wanted here, is trivial
You could say "but that's more complex", but to me it's that the JVM has far more mature features, tons of tooling and options that they could explore and adopt, and that the obvious wins are trivial to achieve through basic parameter tuning.
Further, this GOGC parameter seems to be a very weird knob. The knobs you'd run into with the JVM will often be a lot more straightforward ie: a static value for heap size vs some number that's based on a working set percentage.
I wonder if over time Go will end up with a tunable GC.
- Zababa 5y agoThis to me looks like the classic "language 1 needs you to write more code, language 2 needs you to know and use more features", which is an endless debate.
- The_rationalist 5y agofalse dilemna, if you are too mediocre to study your tech you can still write more code, it's not an exclusive property of language 1
- pphysch 5y agoI think the GPs point is that, starting from 0, both require effort AND are reusable. The "debate" is usually between people who have committed to either path (creating tools or learning tools) and think that just because the marginal cost of my approach, for me is 0, it must be 0 for everyone else. Which is patently false.
- erik_seaberg 5y agoI feel we can safely assume that tuning the JVM GC might cause behavior that’s pathologically slow but never actually incorrect, which is inherently safer than rewriting a bunch of production code (probably more than once) hoping for a similar result.
- staticassertion 5y agoI don't really see it that way. The JVM has a lot of tooling already for GC tuning and a lot of simple, powerful knobs to turn. It seems not only simpler and more straightforward to tune the JVM but the ceiling for what you can do is much higher. With Go there's one parameter, and in my opinion it's a very strange one. It also seems strange to have to (imo) hack GC metrics in using finalizers, whereas with the JVM it's simply provided to you. Full disclosure though, I think Go is a bad language, so I'm biased.
- philosopher1234 5y agoits weirdly black and white to think a language is "bad", particularly one in heavy use
- stouset 5y agoI think C is a bad language. Necessary at the time? Sure. Is everything about it bad? Of course not. But by modern standards it’s bad, and the sooner we can migrate code away from it and onto languages with fewer footguns the better. It’s weirdly black and white to assume that just because someone thinks a language is “bad”, that opinion doesn’t have nuance. Full disclosure, I also think go is a bad language ¯\_(ツ)_/¯
- philosopher1234 5y agoI don’t understand, you think ideally there would be 0 code written in go? You don’t see anything interesting or appealing about it? Also, calling a language bad is black and white, observing that is not black and white.
- stouset 5y agoI just tried to make the point that thinking a language is “bad” doesn’t mean that there isn’t nuance behind that opinion, and so you immediately jump to the conclusion that I believe such a language has zero redeemable qualities and should be stricken from the Earth? Hell, I enjoy writing C but I still think it’s a bad language.
- jatone 5y agoseems like they were able to tune it just fine given they wrote a library.
- staticassertion 5y agoI didn't say otherwise, I'm just comparing the two approaches. We have a very interesting, rare situation where one company has published a blog post on GC tuning across two languages, it seems appropriate to compare them.