logoalt Hacker News

brunoborges • today at 6:55 PM • 1 reply • view on HN

Lots of details that teams miss when tuning the JVM on Kubernetes:

1. Default heap size varies: it can be 50% of the available memory for any amount of available memory up to 256mb; ~128mb for anywhere between 256 and 512; and then 25% for anything above 512mb;

2. The JVM will still do parallel threads even when CPU limit is 1,000 or below , which triggers CPU throttling much faster. Threads such as GC (even when it is SerialGC), ForkJoin pools, Database connection pools, HTTP server, and so on.

3. The JVM behaves MUCH better with 2,000 or more milicores, and a well sized heap. Having very small containers and dozens of replicas is worse than having slightly bigger containers (cpu/memory limits) and fewer replicas, even with a different ratio (e.g. 6 replicas will perform worse than 3 replicas, even when aggregated CPU and memory limits are the same).

I've been advocating on this for years [1].

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


Replies

gavinray • today at 8:41 PM

Modern JVM's (JDK +10) have runtime detection for whether they're operating in a container environment, and apply sensible defaults based dynamically on resources if so.

Google term: "-XX:+UseContainerSupport"

➕ show 1 reply