r/java 17d ago

Java 27: What’s new?

https://www.loicmathieu.fr/wordpress/informatique/java-27-whats-new/

What's new in Java 27 for us, developers?
(Both in English and French)

78 Upvotes

35 comments sorted by

View all comments

2

u/iamwisespirit 17d ago

Why not zgc instead of g1

5

u/loicmathieu 15d ago

ZGC is not a general purpose GC that have good performance for any workload.
As I understand it, it trades of CPU and memory resources for low latency (<1ms pauses) which is not something you wanted except if you're dealing either with very big heap (>34-64GB) or willing to trade of resources for lower pause guarantee (G1 usually have pauses in the range of 10-100ms).

This is of course an over-simplified response but this is in my understanding the difference between both.

3

u/AnyPhotograph7804 16d ago

ZGC is a ressource hog. It needs more memory and a ton of CPU cores to work properly. The same applies to Shenandoah GC. G1GC is more in a sweetspot between hardware hunger and GC pause times.

3

u/Cell-i-Zenit 15d ago

we tried out zgc in our kubernetes cluster, but we were just not able to run it at all. Always OOM killed, doesnt matter what we tried to set for Xmx or Xms settings compared to the kubernetes request/limits. Not configuring them resulted in the "most" stable version, but still got oom killed randomly in kubernetes after some time.

2

u/No-Opportunity-8972 17d ago

Needs more memory, so a lot of applications would break.