Deep Dive into ZGC: A Modern Garbage Collector in OpenJDK (2022) [pdf]
dl.acm.org
dl.acm.org
This or why NMT shows stupid numbers when using ZGC.
TBH the more I dived into JVM memory management the more disgusting it became.
You cant be sure of anything, its totally not straightforward, has many pitfalls and requires stupid amount of useless JVM only knowledge to work well.
Im starting to think that in containers age, an intermediate bytecode language is not needed anymore.
May be the reason why CPython or Go see such huge adoption in contenerised world.
Required simply by ZGC to work, but still its super confusing and convoluted and our tooling is not aware of that at all.
I wouldn't say that tooling is not aware of all that. For example, top and htop display virtual memory and resident memory and shared memory. You need to look at resident memory if you want to know physical memory usage.
Best you can do is do dumps, verify, enable NMT, verify.
It gives me no value to know that my heap is 60m, but my RSS is 600mb while reserved is 40GB. Need more details and those are not always provided i.e. “Unknown” category in NMT details.
Best is that top, pmap and nmt are all showing completely different values for resident size :> and its not a unit issue.
But you're right more broadly, it's nice to not have bad performance be a bunch of finger pointing between dev and ops with Go. With Java there's always another, untried GC twiddle to fix everything.
That hasn’t been true since.. forever. If you have GC problems with Java, you are doing something stupid in 99% of the cases that can be easily fixed by any kind of profiler. That’s not true for most other GCd languages.
Last time I tried to build a lean Java project, I end up with 300MB heap. With small Go service, it can easily live on 30MB container.
And you can just ignore anything GC specific almost all the time..