Engineering With Java

Engineering With Java

Spring Boot Interview Question: HikariCP Connection Timeout

Connection pool, transaction boundary, timeouts and more...

Suraj Mishra's avatar
Suraj Mishra
Feb 05, 2026
βˆ™ Paid

Scenario

You have a Spring Boot application using HikariCP with the following configuration:

spring.datasource.hikari:
  maximum-pool-size: 10
  connection-timeout: 30000

The application receives low QPS (5–10 requests/sec), but you occasionally see this error in the logs:

HikariPool-1 - Connection is not available, request timed out after 30000ms.

What does this HikariCP error actually mean?

All connections in the pool are checked out and none became available within connectionTimeout(30s).

Common misconception: It’s not necessarily due to high traffic; it often means connections are held too long or never returned.


πŸ“’ Get actionable Java/Spring Boot insights every week β€” from practical code tips to real-world use-case based interview questions.
Join 4300+ subscribers and level up your Spring & backend skills with hand-crafted content β€” no fluff.

Become paid subscriber and unlock all the benefits at $2.5/mo (with annual subscription).

Not convinced? Check out the details of the past work


Why it happens at low QPS

  1. Connections are not being released (most common)

    Typical causes:

    • Missing transaction boundaries

      @Transactional
      public void methodA() {
          methodB(); // starts another transaction?
      }
    • Nested / mis-scoped transactions

    • Long-lived transactions

    • Transactions around non-DB logic


    Symptom

    • QPS is low

    • Active connections slowly climb

    • Pool never recovers

    Fix

    • Keep transactions short

    • Wrap only DB work

    • Avoid @Transactional on controllers

User's avatar

Continue reading this post for free, courtesy of Suraj Mishra.

Or purchase a paid subscription.
Β© 2026 Suraj Mishra Β· Privacy βˆ™ Terms βˆ™ Collection notice
Start your SubstackGet the app
Substack is the home for great culture