SDP-Inc / xl-server

Excel App Server
0 stars 0 forks source link

JDBC Connection Pooling #1

Open derek-meulmeester opened 9 years ago

derek-meulmeester commented 9 years ago

Currently anytime we execute a query we are creating a new Connection to our appDataSource. Proof:


10:45:45.943 [http-apr-8080-exec-2] DEBUG org.xl.db.dao.impl.UserDaoImpl - Fetching User Object for ID[1234]
10:45:45.943 [http-apr-8080-exec-2] DEBUG o.s.jdbc.core.JdbcTemplate - Executing prepared SQL query
10:45:45.943 [http-apr-8080-exec-2] DEBUG o.s.jdbc.core.JdbcTemplate - Executing prepared SQL statement [SELECT * FROM "USERS" WHERE UserID=?;]
10:45:45.943 [http-apr-8080-exec-2] DEBUG o.s.jdbc.datasource.DataSourceUtils - Fetching JDBC Connection from DataSource
10:45:45.943 [http-apr-8080-exec-2] DEBUG o.s.j.d.DriverManagerDataSource - Creating new JDBC DriverManager Connection to [jdbc:postgresql://localhost:5432/XL]
10:45:45.988 [http-apr-8080-exec-2] DEBUG o.s.jdbc.datasource.DataSourceUtils - Returning JDBC Connection to DataSource

We should instead use Connection pooling with some min/max threshold of connections to keep idle/in use.

meulmeesters commented 9 years ago

Connection Pooling is a good idea. In the oracle world the connections are kept and re-used anyway so the impression that people have that it takes all kinds of tear down/build up is false. That being said all Web Service based apps need connection pooling or else there could be 5 - 100 connections requested depending on the way the services are used.

On Sun, Mar 22, 2015 at 10:48 AM, derek-meulmeester < notifications@github.com> wrote:

Currently anytime we execute a query we are creating a new Connection to our appDataSource. Proof:

10:45:45.943 [http-apr-8080-exec-2] DEBUG org.xl.db.dao.impl.UserDaoImpl - Fetching User Object for ID[1234] 10:45:45.943 [http-apr-8080-exec-2] DEBUG o.s.jdbc.core.JdbcTemplate - Executing prepared SQL query 10:45:45.943 [http-apr-8080-exec-2] DEBUG o.s.jdbc.core.JdbcTemplate - Executing prepared SQL statement [SELECT * FROM "USERS" WHERE UserID=?;] 10:45:45.943 [http-apr-8080-exec-2] DEBUG o.s.jdbc.datasource.DataSourceUtils - Fetching JDBC Connection from DataSource 10:45:45.943 [http-apr-8080-exec-2] DEBUG o.s.j.d.DriverManagerDataSource - Creating new JDBC DriverManager Connection to [jdbc:postgresql://localhost:5432/XL] 10:45:45.988 [http-apr-8080-exec-2] DEBUG o.s.jdbc.datasource.DataSourceUtils - Returning JDBC Connection to DataSource

We should instead use Connection pooling with some min/max threshold of connections to keep idle/in use.

— Reply to this email directly or view it on GitHub https://github.com/SDP-Inc/xl-server/issues/1.

derek-meulmeester commented 9 years ago

Ah that's really interesting/good to know