0
votes

I've configured max pool size as 10 in my Spring boot 2.0 application(I'm using Hikari connection pool). I'm testing my REST API using JMeter. I am trying to simulate 500 concurrent users(Thread Group - > Thread Properties -> Number of Threads (user):500). I expect the test to fail after 20th request but my JMeter test is working perfectly.

spring.datasource.hikari.minimumIdle: 10
spring.datasource.hikari.maximumPoolSize: 10
spring.datasource.hikari.connectionTimeout: 30000
spring.datasource.hikari.idleTimeout: 600000
spring.datasource.hikari.maxLifetime: 1800000
spring.datasource.hikari.connectionInitSql: SELECT 1 FROM DUAL

pom.xml

    <dependency>
        <groupId>com.oracle.jdbc</groupId>
        <artifactId>ojdbc7</artifactId>
        <version>12.1.0.2</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-jdbc</artifactId>
    </dependency>
  1. Even thought I have maximumPoolSize 10 I am able to make 500 connection concurrently. why it is allowing?
  2. Whether my Hikari connection pool setup is wrong? i.e. do i need to disable tomcat connection pool by excluding it in pom.xml (i believe it is not required in Spring 2.0)
1
What are these 500 connections, jmeter threads? If you really want to count database connections you have to count ESTABLISHED tcp connections to the database.LMC

1 Answers

1
votes

Number of concurrent users is the potentially number of requests hitting the server at the same time. Notice it can be on about page (static page) and therefore won't reach/effect the database at all.

Even when request reach the database, then if the pool has reached max active connection, the pool is waiting for a connection, in your case, up to 30 seconds which is alot in term of realtime db transaction.

How to setup datasource is complex, but in general your setting is correct, you are just comparing different metrics.