3 ms·
In a memory constrained environment, we recently noticed the throughput/latency tradeoff being made by the GC, but having to say that this behavior was not obvi
by julenx 9y ago
In a memory constrained environment, we recently noticed the throughput/latency tradeoff being made by the GC, but having to say that this behavior was not obvious in the first place and we had to dive into the source code to understand things better (which is a good benefit of go being open source, as already stated in the article).
The bottom line is that the scavenger will allow the OS to claim free memory only at least 5 minutes after it was GC'ed. For us the solution was to "force" releasing the free memory to the OS [1], and even since then things have been much smoother in the context of our particular app.
On this topic, there's an open issue [2] to look at making the scavenger more prompt and aggressive.
[1] https://medium.com/samsara-engineering/running-go-on-low-memory-devices-536e1ca2fe8f https://medium.com/samsara-engineering/running-go-on-low-mem...
[2] https://github.com/golang/go/issues/16930 https://github.com/golang/go/issues/16930