Hacker News new | past | comments | ask | show | jobs | submit login

I think generational ZGC is going to be the "sane default" soon.



Eh, there's probably always going to be a different answer depending on whether you prioritize latency vs throughput.


Default gc depends on how many cpus and ram vm has. With 1 core it is always serialgc, for example. 2 cores and less than 4 gb - concurrent mark and sweep IIRC. G1GC starts a bit later.


This is so wrong:

>With 1 core it is always serialgc

Even with 1 CPU ParallelGC has lower latencies than SerialGC on 1 CPU. SerialGC will be better on environment with limitations on number of threads, not number of CPUs.

> 2 cores and less than 4 gb - concurrent mark and sweep IIRC

CMS has been deprecated in 11 and removed later in a non-LTS release. JVM ergonomic will automatically turn on >G1GC< when it detects JVM has at least 2 CPUs and 1792Mb of RAM (not heap, memory in total). When either or both numbers are lower then ParallelGC is enabled automatically.


The serial and parallel GCs are best used for applications that care more about throughput than latency (pauses). If you only have one CPU core, running multiple threads isn't going to speed up the GC cycle. The parallel collector just adds overhead due to context switching among threads.


Yeah but you dont necessarily want to use those defaults. They strike me as kind of archaic.

For low resource use cases, you probably want Graal AOT above all else... which means G1GC or serial, I think.


GraalAOT, do you mean native image or C2 compiler? Neither of these tuning is applicable in a discussion about GCs


CMS was removed in 14.


Would be good to have more benchmarks and articles on G1 vs ZGC once that happens.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: