JVM, Tomcat connector và request-thread diagnostics
HTTP latency có thể tích ở kernel accept backlog, Tomcat executor, application locks, DB pool, GC hoặc downstream—đừng chỉ nhìn CPU.
Tomcat request path
Socket accepted by protocol handler/endpoint → connector parses request → executor thread → Servlet filter chain → Spring DispatcherServlet/app → response. maxConnections, acceptCount, maxThreads, keep-alive and timeouts form queues/capacity. Embedded Boot config maps to connector/server properties by version.
Thread pool
Busy threads near max + accept/backlog growth yields queueing/timeouts. Increasing maxThreads may exhaust DB connections/memory/downstream. With virtual threads/executor variants, downstream concurrency still needs bounds. Thread dumps map waiting/blocked/runnable and repeated stacks.
JVM memory/GC
Heap after-GC trend, allocation rate, pause, promotion, metaspace, direct/native, thread stacks and container limit. High heap not always leak; retained growth after full cycles matters. CPU high may GC, JIT, loop or workload.
Diagnostics
Actuator/Micrometer server/request/executor metrics, JFR, GC logs, jcmd thread/histogram/NMT, OS process/thread CPU/RSS/FD/socket. Correlate p99 with GC, pool waits and connector saturation. JMX endpoints require security.
Shutdown
Stop accepting/drain keep-alive/in-flight, Spring graceful shutdown, connector pause and orchestration grace. Tomcat reload/redeploy classloader leaks are less common embedded immutable deployments but understand loader/thread/ThreadLocal retention.