Backend Developer Interview Question

Your API starts returning timeouts under load, but the database CPU is low and queries look fast. Where do you look?

What the interviewer is probing, how to structure your answer, and a spoken example you can adapt.

Quick answer

That combination points to connection pool exhaustion or a similar concurrency limit, not to the database being slow. Check pool wait time and active versus idle connections: requests are queuing for a connection while each holder keeps it too long, often because of a slow external call inside a transaction, a missing timeout, or a leaked connection that is never returned. Fix the holding time first, then size the pool deliberately.

Why interviewers ask this

It is a realistic incident where the obvious metric looks healthy, so it tests whether you reason about the whole request path. The interviewer wants to hear about queueing for a resource, the danger of doing network calls inside a transaction, and why a bigger pool is often the wrong fix. Knowing that pool size should relate to database capacity rather than to instance count shows real operational experience.

How to structure your answer

  • Reframe the symptom as waiting for a resource, not slow queries.
  • Name the metrics that confirm it: pool wait time, active connections, saturation.
  • List the common causes of long connection holding.
  • Explain how you size the pool and what happens if you just raise it.

Example answer

Spoken example, first person

Fast queries plus slow requests means the time is spent waiting for something, and the pool is the usual suspect. I would look at pool wait time and how long connections are held, plus the database side count of active versus idle in transaction sessions. A pile of idle in transaction is the giveaway: something opened a transaction and then did work that is not database work. That is almost always the cause, an HTTP call to a payment provider or a slow serialization step sitting inside a transaction, so each request holds a connection for a second instead of five milliseconds and the pool drains at a fraction of the traffic. The fix is to shorten the critical section: do the external call before or after the transaction, add statement and transaction timeouts, and make sure every path returns its connection even on error. Only then would I touch the size, and carefully, because every instance multiplies it. Raising the pool without fixing the holding time just moves the queue onto the database and turns a slow endpoint into a global outage.

Walking into this interview soon? GhostPilot listens to your live call, spots the question the moment it is asked, and puts a structured answer on your screen in real time. Try it on your next mock, or grab a $29 Session Pass, no subscription, for the real thing.

See how it works

Follow-up questions to expect

  • How would you decide the right pool size for ten application instances?
  • What does idle in transaction indicate, and how do you catch it early?
  • Where does a connection proxy help, and what does it not solve?

Related backend developer questions

Your interviewer will ask their own version of this. Paste your actual job description into the free Question Predictor and get the 20 questions that role is most likely to ask, with what each one is really probing.

Predict my questions

Rehearse the hard questions before they are asked

Practise with a live copilot, then walk in ready. A $29 Session Pass gets you through the interview with no subscription and no lock-in.

Get GhostPilot