
Golang: sub-millisecond GC pause on production 18gb heap - eis
https://twitter.com/brianhatfield/status/804355831080751104
======
karussell
Would be interesting to have a raw comparison to the JVM e.g. to the new GC1
which can handle also >10GB with low pauses. I know from experience (with the
JVM) that you can get nice pauses on average, but what about the maximum
values?

~~~
bascule
Azul's C4 collector can handle 2TB heaps with "pauseless" (<50 microsecond)
operation:

[https://www.azul.com/press_release/azul-systems-extends-
supp...](https://www.azul.com/press_release/azul-systems-extends-support-for-
in-memory-computing-architectures-with-new-release-of-zing-runtime-for-java/)

~~~
karussell
I know and I really like the achievements! Also there are other JVM GCs usable
for RT application. But I would preferable have a comparison between two open
source systems ie. go and openjdk8/9 :)

------
en4bz
GC time is proportional to the number of objects tracked by the GC not the
size of the heap, although they do tend to be related. Without knowledge of
how many objects are being tracked this is a useless metric.

~~~
socmag
Hehe I thought that as well when I read the headline.

"We have three root objects of 6GB a piece!"... ummm :P

I'm sure they must be talking about something other than that, but it did make
me giggle a bit.

------
reacharavindh
Just started learning Go. How is that possible? Does this mean the GC tries to
do its thing without a pause? Or is it not doing its thing? What is happening
here?

~~~
sjwhitworth
[https://groups.google.com/forum/?fromgroups#!topic/golang-
de...](https://groups.google.com/forum/?fromgroups#!topic/golang-
dev/Ab1sFeoZg_8)

~~~
reacharavindh
Thanks for the link. Found the proposal a really good read.

Direct link :
[https://github.com/golang/proposal/blob/master/design/17503-...](https://github.com/golang/proposal/blob/master/design/17503-eliminate-
rescan.md)

------
revelation
Well, congratulations on the bragging rights?! That is magnitudes too long for
actual real-time or low latency use. It is squarely in a no-mans-land of
applications where the worst-case is still too much for games or sound but all
other uses didn't care very much for GC pause in the first place.

~~~
hamandcheese
For gaming, assuming a target of 60fps, a 1ms GC pause still leaves 15.6ms to
render the next frame. Which is 93% of the available time.

~~~
socmag
Or even better..

I've written 3D/Game Engines engines in languages with GC based runtimes that
run at 1500fps with no GC pauses.

How to do it? Easy... don't create garbage! So yes, it is doable. PITA but
doable

Certainly helps if you have a good generational GC.

That said, if you can force a compaction once a frame and it's pretty stable
at a millisecond, I guess that's more than fine for a lot of stuff.

~~~
nameless912
Exactly this. In Java, it's definitely possible to almost completely avoid
garbage, and the GC is tunable enough that you could consistently have the GC
run once per frame, which then makes it just a normal part of the frame timing
if you have a general idea of what is being created. Object pooling is
magical, yo. I imagine in Golang, this would only get easier as the pauses are
super short and I _feel_ more control over the memory allocation (whether this
is true or not is an open question).

~~~
socmag
Yes, definitely a lot of object pooling! :+1:

Use POD's to store data

...and use "int's" instead of references. Those index into tables of the
objects. These will be opaque to the GC so it doesn't have to follow any
pointers.

~~~
nameless912
POD's?

~~~
socmag
Oops sorry.. Plain Old Data structures.

Specifically I mean data structures that contain only basic types and no
reference types or pointers.

[https://en.m.wikipedia.org/wiki/Passive_data_structure](https://en.m.wikipedia.org/wiki/Passive_data_structure)

Another important trick is to use structures of arrays, rather than arrays of
structures. Well that kind of depends on the use case, but you can get huge
wins in memory access if you need to scan only one field.

Same tradeoff as Row vs Column Databases.

