BUG #13825: JDBC Driver Connection Pool Issue

From: mayan(dot)murad(at)kronos(dot)com
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #13825: JDBC Driver Connection Pool Issue
Date: 2015-12-17 21:17:07
Message-ID: 20151217211707.3356.32260@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 13825
Logged by: Mayan Murad
Email address: mayan(dot)murad(at)kronos(dot)com
PostgreSQL version: 9.4.1
Operating system: RHEL
Description:

I have an environment where a Tomcat Application server is configured for a
Tomcat JDBC connection pool that uses the PostgreSQL JDBC driver,
specifically, postgresql-9.4-1206-jdbc42.jar.

My JDBC connection information is as follows:

<Resource name="jdbc/postgres" auth="Container"
type="javax.sql.DataSource" driverClassName="org.postgresql.Driver"
url="jdbc:postgresql://Node1:5444,Node2:5444,Node3:5444/edb?targetServerType=master"
username="enterprisedb" password=“hidden" initialSize="10" maxTotal="20"
maxIdle="10" minIdle="10" maxWaitMillis="-1"/>

Notice that I have 3 nodes and that I want the initial number of pooled
connections to be 10. After starting up Tomcat, I check pg_stat_activity to
see my connections that were established to the Master node. To my
surprise, I saw 30 connections! I then reduced the number of nodes in my
JDBC URL and I still saw 30 connections, even with just one node in the JDBC
URL.

Next, I reduced the value for initialSize and the pattern remained
consistent. I would always see 3 times the number of connections specified
in initialSize. I have a 3 node cluster as well, so I'm not sure if is
somehow getting the multiple from there.

We are going to have several Application Servers and don't want to incur
cost of creating connection to the database as users request them, so we
will definitely have some connection made at startup using the initialSize
parameter. This could dramatically increase the number of connections made
to the database.

Browse pgsql-bugs by date

  From Date Subject
Next Message John R Pierce 2015-12-17 23:46:00 Re: Known issues on PostgreSQL server 8.1.19
Previous Message Bruce Momjian 2015-12-17 20:23:04 Re: BUG #9923: "reassign owned" does not change permissions grantor