Skip to content
Permalink
Browse files

Update connection pool cofig

- Increase the min pool size to 10 connections. Openleg uses 10+
connections when doing its data processing every minute, so there is no
point to starting with less than 10 connections.
- Set the initial pool size to the same as the min pool size, 10.
- Set an optimal query for testing connections.
  • Loading branch information
KevinCaseiras committed Nov 20, 2019
1 parent 144d63a commit 957adfd11fdc8ea0a8948d5b254ec126c572d4df
Showing with 4 additions and 1 deletion.
  1. +4 −1 src/main/java/gov/nysenate/openleg/config/DatabaseConfig.java
@@ -58,13 +58,16 @@ public ComboPooledDataSource postgresDataSource() {
logger.info("Connecting to Postgres: " + pool.getJdbcUrl());
pool.setUser(dbUser);
pool.setPassword(dbPass);
pool.setMinPoolSize(8);
pool.setInitialPoolSize(10);
pool.setMinPoolSize(10);
pool.setMaxPoolSize(20);

// Test each connection every 60 sec after first check-in
pool.setTestConnectionOnCheckout(false);
pool.setTestConnectionOnCheckin(true);
pool.setIdleConnectionTestPeriod(60);
// Fast query to execute when testing connections
pool.setPreferredTestQuery("SELECT 1");
return pool;
}

0 comments on commit 957adfd

Please sign in to comment.
You can’t perform that action at this time.