5
votes

I am creating microservices applications using spring boot. All these microservices will connect to a single database AWS Aurora Serverless. I am planning to configure the connection pooling in my applications using HikariCP. Based on my initial research, Aurora Serverless manages connection pooling automatically. My question are the following.

  1. Do I still need to configure connection pooling in my microservices using HikariCP? If yes, what is the recommended configuration in spring boot application.yml considering these are microservices that would share the same database?

  2. If connection pooling configuration is not needed in my microservices, should i disable it? And, how should I do it my application.yml.

I have initial hikaricp configuration as shown in my code below

Springboot version is 1.5.7.RELEASE

application.yml
spring:
 datasource:
 type: com.zaxxer.hikari.HikariDataSource
 hikari:
   connection-timeout: 30000
   minimum-idle: 30
   maximum-pool-size: 200
   idle-timeout: 30000    

... database details (url, password, etc...)
1

1 Answers

0
votes

A connection pool is still useful since there will be a cost to build a connection from your app to their connection pool.

What is different is that when you don't have any activity during a significant amount of time (night/weekend/periods of no activity) or when speed is not a necessity you should put the minimum-idle parameter to zero. This will make sure the number of connections goes down to zero and enable your aurora serverless db to go into pause. When it is paused you pay only for storage costs.