Non persistent Database Connections?


i’m using Play 2.6 with Ebean and HikariCP. For my staging environment i’m using AWS and their great Aurora Serverless MySQL Database. If there are no connections to the database, the database is going to sleep and incur no costs during that time. This is great for staging and testing environments, because you only pay, when you are actually using the ressources.

However using Play, there are constantly like 15 connections to MySQL (as configured in HikariCP). Is there a way to configure it so, that the connection to the database is not persistent, like with PHP? Say if the connections are idle for 10 minutes, they are closed and a new connection is opened, only when there is actually a user request?

That would be great, otherwise i would have to pay the minimum of 100$ / month for the MySQL Server.



Did you check the HikariCP configuration settings?

   # The connection timeout
   connectionTimeout = 30 seconds

   # The idle timeout
   idleTimeout = 10 minutes

   # The max lifetime of a connection
   maxLifetime = 30 minutes```

Thanks. After checking this out, i realized, that i had to explicitly set minimumidle to 0 in order for it to work. First i tried to comment it out, but then it did not work.

Correct if you comment it out, it would fallback to some default (10 min I guess).