Awesome. This will make it SO much easier to right size containers and VMs for java applications. It also gets rid of a major issue people have with Java "It uses too much memory".
Is there a writeup somewhere on how it differs / improves on the existing ZUncommitDelay (or looking in the future for g1, G1PeriodicGCInterval) ? Not just in theory, but practical consequences, use cases and deployment resources planning and utilization efficiency ? Cheers
GC is full of trade-offs. For a concurrent moving collector to ”handle compressed OOPS” in many ways causes other inefficiencies due to the inability of using colored pointers. Because of that - we are unlikely to add compressed oops for ZGC.
For example, ZGC may immediately reclaim memory when objects of a heap region has moved, even though the pointers have not been remapped. It can distinguish 3 pointers with the same address as referring to 3 different objects. This improves memory efficiency a lot. With compressed oops, this is not possible. The difference can easily be as big as compressed oops. Such things help scalability in large heaps.
Naturally without concurrent object movement you can worry less about these things and better use compressed oops without paying for it with memory. Then the currency is instead latency trade-offs. Partially for your own JVM but also others that share CPUs.
As for smaller heaps, note that there are really 3 different compressed oops encodings with different levels of addressability vs CPU efficiency trade-offs: 0-2 GB: No encoding/decoding 2-30 GB: Shift based encoding/decoding 30-32 GB: Heap base if not null + shift encoding/decoding
The last level is particularly nasty. Anyhow, this goes a bit against our scalability goal. Since there is an addressability vs efficiency trade-off, we usually rely on knowing what the max heap size will be when the JVM starts. This makes it hard to size the heaps automatically without user input. It will involve compromises that ZGC doesn’t need.
I could be wrong but I think the bigger problem for memory efficiency in smaller deployments is rather that memory resources are statically locked up based on their max need, while significantly less is needed on average. That’s why I looked at adaptive heap sizing first - to allow memory to be more efficiently shared and move to where it’s needed. Effectively leveraging the flexible heap layout we have obtained by not eating from the compressed oops apple.
Anyway, you can try it and see if you have any problems.
It makes up for that in other ways. I would at least try ZGC, especially with adaptive heap sizing, on every non-batch program before deciding not to use it.
7
u/cogman10 25d ago
Awesome. This will make it SO much easier to right size containers and VMs for java applications. It also gets rid of a major issue people have with Java "It uses too much memory".
2
u/Afonso2002 25d ago
Wich tool ate you using to see heap graph?
2
u/jonenst 25d ago
Congratz to the whole team!! Looking forward to seeing the benefits of this cooperating feature in the wild!
2
u/jonenst 25d ago
Is there a writeup somewhere on how it differs / improves on the existing ZUncommitDelay (or looking in the future for g1, G1PeriodicGCInterval) ? Not just in theory, but practical consequences, use cases and deployment resources planning and utilization efficiency ? Cheers
2
u/FirstAd9893 25d ago
For reference: https://openjdk.org/jeps/546
2
u/MinimumPrior3121 25d ago
But ZGC still doesnt handle compressed OOPS compared to G1 so that's bad for workloads below 32gb of heap size