logoalt Hacker News

Sid_Lmao • last Tuesday at 5:18 AM • 4 replies • view on HN

Easy-to-miss detail: before JDK 27, the JVM only picked G1 with 2+ CPUs and ~1.8 GB of memory; otherwise, it silently used SerialGC. So a lot of 1- CPU Kubernetes pods have been on serial all along. Worth checking with -XX:+PrintCommandLineFlags before upgrading, since GC behaviour will change.


Replies

brunoborges • today at 6:49 PM

This is correct. I have been advocating about this for years now [1].

I have also seen customers wasting resources across Kubernetes because their developers would eventually tune JVMs with lowercase `-xmx` flag, which the JVM ignores, and thus by default, the JVM only sets heap size to 25% by default (for => 512mb of available memory).

[1] https://www.youtube.com/watch?v=wApqCjHWF8Q

seabrookmx • today at 6:38 PM

> So a lot of 1- CPU Kubernetes pods have been on serial all along

I don't think this is true.

Setting your CPU limit to 1 in Kubernetes does not mean the container sees a single logical processor. It only means the kernel allows it to use 1 core worth of CPU _time_.

If your k8s node is an 8 core node, Java will still see 8 logical processors. It just means you can only use 1/8th of each, or all of one, or some combination in-between.

I've never seen a k8s node running on a single core VM, as most of the cloud providers only use these for their free tier or shared core VM's for the lightest of light workloads.

➕ show 1 reply
pjmlp • today at 6:49 PM

Open JDK, not The JVM.

There are other implementations.

citrin_ru • today at 3:03 PM

Isn't the reason for this that on a single core SerialGC is better (lower CPU overhead at least)?

➕ show 3 replies