6 ms·
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.
by popfalushi 4y ago
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.
- brucethemoose2 4y agoYeah 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.
- agilob 4y agoGraalAOT, do you mean native image or C2 compiler? Neither of these tuning is applicable in a discussion about GCs
- lkorinth 4y agoCMS was removed in 14.
- agilob 4y agoThis 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.
- hashmash 4y agoThe 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.