Home How can I tell Spring to create more database connections when maxActive is reached?
Reply: 0

How can I tell Spring to create more database connections when maxActive is reached?

user1202
1#
user1202 Published in May 23, 2018, 8:02 pm

I have a Spring Boot app with below database pool settings. If the app continuously runs for 2 to 3 days, I get pool empty error. So, 2 questions regarding this,

  1. I really suspect connection leaks might have happened. No. of users for our application is very less, so 32 should not be exhausted for our user base. How can I find leaked connections?
  2. If I want to tell Spring to create few more connections when maxActive(32 in my case) is reached, what is the setting needs to be added?

    poolProperties.setTestOnBorrow(true);
    poolProperties.setTestOnConnect(true);
    poolProperties.setTestWhileIdle(true);
    poolProperties.setInitialSize(10);
    poolProperties.setMinIdle(10);
    poolProperties.setMaxIdle(10);
    poolProperties.setMaxActive(32);
    poolProperties.setMaxWait(5000); //5 secs
    poolProperties.setLogValidationErrors(true);
    poolProperties.setLogAbandoned(true);
    poolProperties.setValidationQuery("SELECT 1");
    

o.h.e.jdbc.spi.SqlExceptionHelper.logExceptions(129) - [http-nio-6061-exec-9] Timeout: Pool empty. Unable to fetch a connection in 5 seconds, none available[size:32; busy:32; idle:0; lastwait:5000]

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.307551 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO