upvote
Isn't the reason for this that on a single core SerialGC is better (lower CPU overhead at least)?
reply
A 1,000 millicore CPU limit on Kubernetes does not mean the JVM can only use a single core. But that is indeed how the JVM interprets the limit: as a single core being available.
reply
Lower overhead yes - but G1 should have shorter pauses. And shorter pauses is probably worth it unless you run only background jobs in your jvms.
reply
Lower CPU and Memory overhead.

Serial will be your best choice if your app is constantly using 100% of that core or if you need to minimize the amount of memory overhead.

G1 is a better choice if you can be flexible with your memory and if you have a lot of periods in your app where it's below 100% CPU usage (maybe a lot of IO).

reply
I'd imagine so. The kind of bookkeeping they're talking about here would negatively effect performance on a single core.
reply
> 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.

reply
> Setting your CPU limit to 1 in Kubernetes does not mean the container sees a single logical processor

that's incorrect, the jvm has been container aware for nearly a decade (https://bugs.openjdk.org/browse/JDK-8146115)

you are correct about the underlying scheduling. limits don't pin you to a core, you get quotas across all available

reply
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

reply
Open JDK, not The JVM.

There are other implementations.

reply
Not really, other than OpenJ9. In my experience, it's way behind OpenJDK in terms of performance and stability.
reply
Then you never embedded development with real time JVMs, for example.
reply