Quick revision
The short answer
Low CPU with high latency almost always means the requests are waiting, not working. I would first check what changed (a deployment, a configuration change or a new traffic pattern), then take several thread dumps a few seconds apart with jcmd Thread.print and look for many threads blocked or waiting on the same thing, and at the same time check connection pool metrics such as hikaricp.connections.pending, downstream latency and GC pauses. The usual culprits are an exhausted connection pool, lock contention, a slow downstream service or slow DNS.
What to remember
In this answer, we saw that high latency with low CPU means requests are waiting, so we look for what they wait on. We check recent changes first, take several thread dumps a few seconds apart to find threads parked on the same resource, and use pool metrics such as hikaricp.connections.pending, downstream latency and GC pauses to explain why. The usual causes are pool exhaustion, lock contention, slow downstreams and DNS, and the fix removes the wait rather than adding capacity around it.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
Low CPU with high latency almost always means the requests are waiting, not working. I would first check what changed (a deployment, a configuration change or a new traffic pattern), then take several thread dumps a few seconds apart with jcmd Thread.print and look for many threads blocked or waiting on the same thing, and at the same time check connection pool metrics such as hikaricp.connections.pending, downstream latency and GC pauses. The usual culprits are an exhausted connection pool, lock contention, a slow downstream service or slow DNS.
Why this question is asked
When latency explodes and the CPU graph is flat, many engineers start by scaling out, which often makes things worse because more pods compete for the same database or downstream. Interviewers ask this to see whether we can reason from symptoms to evidence: what low CPU tells us, which data to collect first while the problem is still happening, and how to read it. In this answer, we will recap what low CPU means, list what to check first, take and read thread dumps, look at the pool and GC metrics, and walk through the most common causes with an example.
1What Low CPU Tells Us
A request in a Spring Boot service runs on a worker thread, by default one of Tomcat's 200 threads. While it computes, it uses CPU. While it waits for a database connection, a lock, a remote HTTP call or a DNS answer, the thread is parked and uses no CPU at all. So if p99 latency, the time within which 99 percent of requests finish, jumps from 200 ms to 8 seconds while CPU stays low, the extra 7.8 seconds are almost certainly spent waiting.
That one observation removes a whole class of causes, such as a hot loop or heavy serialisation, and points us at the things requests wait for.
2First Questions: What Changed?
Before touching the JVM, I would spend two minutes on recent changes, because most incidents follow one. Was there a deployment of this service or of something it calls? Was a configuration value changed, such as a pool size or a timeout? Did traffic change shape, for example a new client sending large batches, or a marketing email that doubled requests to one endpoint? Deployment history, the configuration repository and the request rate per endpoint answer these quickly. If a deployment lines up with the jump, rolling it back is often the fastest mitigation, and we keep investigating with the evidence we collected.
3Taking Thread Dumps a Few Seconds Apart
A thread dump lists every thread in the JVM with its state and stack trace. One dump is a snapshot; three to five dumps taken about five seconds apart show what is stuck rather than what happened to be running at that instant.
Notice the pattern: 183 of 200 workers are parked in the same frame, HikariPool.getConnection, in every dump. They are waiting for a database connection. If instead they were BLOCKED on the same monitor, the dump would name the lock and the thread holding it, and if they were all in a socket read inside an HTTP client, a downstream call would be the suspect.
4Checking the Pool, Downstreams and GC
Thread dumps tell us where threads wait; metrics tell us why. Spring Boot exposes HikariCP metrics through Micrometer. hikaricp.connections.active shows connections in use, hikaricp.connections.pending shows threads waiting for one, and hikaricp.connections.acquire shows how long getting a connection takes. In our example, active would sit at the maximum of 10 (HikariCP's default pool size) and pending would be in the hundreds.
A full pool has two possible reasons: queries got slower, so each connection is held longer, or something holds connections without using them, such as a transaction that also makes a slow HTTP call. So next we look at database query latency and downstream HTTP client timers such as http.client.requests. Finally we check GC: the JVM's GC pause metrics or GC log.
- Anything deployed or changed?YesRoll back, keep investigatingNoCollect evidence
- Take 3 to 5 thread dumps, 5 s apartFind what most workers wait on
- Waiting for a pool connection?YesCheck pending, active, query timeNoLook at locks and HTTP calls
- Blocked on one lock?YesFind the holder in the dumpNoCheck downstream and DNS latency
- Check GC pausesRule out stop-the-world pauses
5 steps in order. Play them, or step through them one at a time.
Each step answers what the threads are waiting for.
Notice that the flow keeps returning to the same question: what are the threads waiting for, and why does that thing take longer than before?
5The Usual Causes
With the evidence in hand, the cause is usually one of four. Pool exhaustion happens when a query slows down, for example after a missing index or a lock in the database, or when code holds a connection during a remote call. Lock contention appears when a synchronized block or a shared resource serialises all requests. A slow downstream with a long or missing timeout lets each request wait for many seconds; with 200 threads and a 10-second downstream call, the service is full after 20 requests per second to that endpoint. And slow DNS, for example a resolver timing out before a retry succeeds, adds whole seconds to new connections.
Here is the classic version of the first cause and its fix.
The reason the fix works is that a connection is now held only for the short update. The remote call still takes time, but it no longer blocks every other request that needs the database.
6Follow-up questions
How do you take a thread dump in a container without a JDK installed?
Several ways work. Sending SIGQUIT with kill -3 1 makes the JVM print a thread dump to its standard output, so it appears in kubectl logs. If Spring Boot Actuator is enabled, the threaddump endpoint returns the same information over HTTP, protected by our access rules. We can also attach an ephemeral debug container with a JDK using kubectl debug and a shared process namespace, then run jcmd from it; the user and temporary directory must match for the attach to work, so check your setup.
Why not just increase the pool size?
If queries got slower or connections are held during remote calls, a bigger pool just moves the queue into the database, which then has more concurrent work and can slow down further. We first find why each connection is held longer. Sometimes the pool really is too small for the traffic, and Little's law with the measured hold time tells us the right size.
What timeout settings would you check?
The HTTP client connect and read timeouts for every downstream, HikariCP's connectionTimeout (30 seconds by default, which is far longer than a user will wait), database statement timeouts, and the overall request timeout at the gateway. Timeouts should be shorter as we go deeper, so the caller gives up after its callee.
7Conclusion
In this answer, we saw that high latency with low CPU means requests are waiting, so we look for what they wait on. We check recent changes first, take several thread dumps a few seconds apart to find threads parked on the same resource, and use pool metrics such as hikaricp.connections.pending, downstream latency and GC pauses to explain why. The usual causes are pool exhaustion, lock contention, slow downstreams and DNS, and the fix removes the wait rather than adding capacity around it.
Open with
Low CPU with high latency tells me the threads are waiting, not working, so I am looking for what they wait on. First I would check what changed: deployments of this service or its dependencies, configuration changes and traffic patterns, because if a deployment lines up I would roll it back to mitigate.
Then, if they want more
While the problem is live, I take three to five thread dumps about five seconds apart with jcmd Thread.print, or kill -3 if the image has no JDK. Then I group the worker threads by state and top frame.
If most of them are parked in HikariPool.getConnection, the pool is exhausted, and I check hikaricp.connections.active, pending and acquire time, plus query latency, to see whether queries got slower or something holds connections during a remote call. If they are BLOCKED, the dump names the lock and the thread holding it.
If they are in socket reads, I look at downstream latency and timeouts, and I keep DNS in mind for new connections. I would also glance at GC pause metrics to rule out long pauses.
The fix depends on the cause, but a common one is a transaction holding a connection while calling a slow service, which I would fix by moving the call out of the transaction and adding a short timeout, not by just growing the pool.
About this answer
- Last updated
- 12 November 2026
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- Kubernetes documentation, Spring Boot reference
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "You are on call and a Spring Boot service's p99 latency jumped from 200 ms to 8 seconds...": https://scrivio-interview-library.netlify.app/spring-boot/production-operations/4854c58d6d/