“Unable to acquire JDBC Connection” is staring at you from your production logs. Your connection pool is running out of database connections. What

Running Out of Database Connections

submited by
Style Pass
2021-09-13 13:30:09

“Unable to acquire JDBC Connection” is staring at you from your production logs. Your connection pool is running out of database connections. What do you do?

Imagine you’ve worked for a year on a modern microservices application with complex external integrations, the client has spent weeks testing it, and you’ve fixed all the reported bugs. You get the official signoff and the public release goes smoothly, the first users are online, and everything is working.

You leave for the release party, and two beers in, the bug strikes. Your database connections are timing out, and your connection pool is full, even though it should be able to handle 10 times more users. The clock is ticking and it’s on you to fix it.

Sounds a bit too specific? That’s because it actually happened to me three years ago, and in this blog post, I’ll walk you through the steps I took to understand the problem and fix it.

To illustrate this problem, I created an example repository with Spring Boot, Spring Data, and a Postgres database. Although the debugging techniques I want to show you are general, the problem is specific to this tech stack.

Leave a Comment