As asked
Oracle's enterprise Java services often require tuning the JVM garbage collector to avoid long pauses. Explain the generational hypothesis, compare G1GC with ZGC, and describe how you would diagnose and reduce GC pause times in a service that must respond within 50 milliseconds.
Sample answer outline
A strong answer covers the generational hypothesis (most objects die young), how G1GC divides the heap into regions and predicts pause time, and how ZGC achieves sub-millisecond pauses by doing most work concurrently using load barriers. Diagnosis uses GC logs with -Xlog:gc*, heap dumps for retained objects, and JFR recordings. Tuning levers include heap sizing, region size in G1, and explicit tuning of young/old generation ratios.
Expect these follow-ups
- When would you choose GraalVM native image over a standard JVM deployment for an Oracle Cloud Function?
- How do you identify whether a pause is GC-related versus a safepoint stop caused by something else?