JVM tuning
16 questions in 5 subtopics.
Heap sizing
What do -Xms and -Xmx do, and why do many teams set them to the same value for server applications? What is the container-friendly alternative?How do you choose the heap size for a new service before production? Describe a method based on measurement rather than guesswork.Your cloud bill shows JVM pods requesting 4 GiB of memory while median RSS is 1.5 GiB. How would you run a right-sizing program across 500 services without causing OOM incidents?JVM flags
How do you see the effective value of every JVM flag, both for a given command line and for a JVM that is already running?After upgrading from JDK 11 to JDK 21, a service fails at startup with an Unrecognized VM option error for an old GC-related flag it has used for years. What happened, what do you do, and how do you prevent this?Your platform team ships a base container image used by all Java services. Decide which JVM options go in the base image for everyone and which stay per service, and explain how you deliver them.Container awareness
How does a modern JVM detect container limits? If you run a JVM without -Xmx in a pod with a 1 GiB memory limit and 2 CPU limit, what heap and processor count will it use?On a host using cgroup v2, a service built on an old JDK 8 update reportsRuntime.availableProcessors() equal to the node's 64 cores and sizes its heap from the node's memory instead of the pod limits. Explain the impact and fix.Write the container sizing policy for JVM services in your company: CPU requests and limits, memory, and heap percentage. Explain the reasoning behind each rule.Before JDK 10 the JVM ignored container limits; later it learned cgroup v1 and then cgroup v2, and the way CPU shares are used changed in later releases. What does this history teach about relying on runtime auto-detection in your infrastructure over the next decade?Ergonomics
What is JVM ergonomics? List decisions it makes when you start a JVM with no tuning flags.The same service image runs on 1 CPU / 1.5 GiB pods in staging and 4 CPU / 8 GiB pods in production. Engineers see different GC logs, thread counts and performance profiles between the two. Explain what differs and what you would change.OpenJDK has ongoing work toward collectors that size the heap automatically from load and available memory. Should your organisation plan to move from explicit per-service heap settings to self-sizing JVMs over the coming years? How would you decide?Tuning methodology
Why is it a bad idea to copy a list of JVM tuning flags from a blog post into your service?A JVM service misses its p99 latency SLO. Describe your tuning methodology from start to finish.A long-lived service carries 40 JVM flags added over a decade, many copied from old articles. Over the long term, what stance should the organisation take on JVM tuning, and how do you change the culture?No question matches these choices.