Java at peak runs into four limits: heap size against the container, GC pauses, the Tomcat thread pool and the HikariCP pool. I'd fix the heap first, because the JVM's default heap uses a quarter of the container's memory. Start with Fix Java Heap Space OOM in Kubernetes Containers.
- G1 vs ZGC and How to Catch Java GC Pause Spikes
Alert on Java GC pause latency and full GCs before users notice p99 spikes, then use the same metrics to decide between G1 and ZGC.
- Fix Java Heap Space OOM in Kubernetes Containers
Size the JVM heap from the container limit with MaxRAMPercentage and leave room for native memory, so pods stop failing with heap errors or OOMKilled.
- Fix HikariCP Connection Is Not Available, Request Timed Out
Size the HikariCP connection pool in Spring Boot from your database limit and pod count, so requests stop timing out while they wait for a connection.
- Spring Boot Virtual Threads and server.tomcat.threads.max
Size server.tomcat.threads.max from your traffic, or turn on Spring Boot virtual threads, so requests stop queueing inside Tomcat at peak.