0

I use a connection pool on tomcat for my java web application. Connections tomcat created was not what I had in mind. Do I misunderstand properties initialSize, maxTotal, maxIdle, minIdle ?

Tomcat 8.0.48/PostgreSQL 9.4.9

My connection pool setting on Tomcat is;

<Resource name="jdbc/postgres_test" auth="Container"
           type="javax.sql.DataSource"
           driverClassName="org.postgresql.Driver"
           url="jdbc:postgresql://hostname:5432/sss_test"
           username="sss_test"
           password=""
           initialSize="10"
           maxTotal="10"
           maxIdle="10"
           minIdle="0"
           maxWaitMillis="10000"
           testOnBorrow="true"
           validationQuery="select 1"
           timeBetweenEvictionRunsMillis="5000"/>

Then I checked connections by sql on psql, It was like below, (same as using netstat command)

sss_test=> SELECT count(client_addr) FROM pg_stat_activity group by client_addr;
   client_addr  | count
  --------------+-------
   A            |    30

I expected 10 connections but it was 30.

Jes
  • 21
  • 3

0 Answers0