Interview Prep/Real-World Interview/Scaling and performance

A Java service on Kubernetes is slow for the first minute after every deploy. Why, and what helps?

IntermediateScenarioScaling and performance
Answer

Situation read → JVM warm-up: class loading, JIT compilation and empty caches. New pods get full traffic as soon as they pass readiness.

What I'd do →

  1. Use a startupProbe so slow startup isn't killed by liveness, and make readiness reflect real readiness.
  2. Warm up before ready: hit key endpoints internally on startup, or pre-load caches, then report ready.
  3. Give CPU headroom at startup; low CPU limits make JIT painfully slow. Consider no CPU limit, or startup CPU boost tooling.
  4. Ramp traffic gradually: ALB slow start on target groups.
alb.ingress.kubernetes.io/target-group-attributes: slow_start.duration_seconds=60
  1. Longer term, consider CDS/AppCDS or GraalVM native image for faster startup.

Why → Readiness answers "can it serve?" not "can it serve fast?". Slow start bridges the gap.

Interview tip → ALB slow start is a concrete, lesser-known setting worth naming.

All Real-World Interview questions Roadmap: Interview readiness

More on Scaling and performance