O'Reilly logo

Hands-On High Performance with Spring 5 by Dinesh Radadiya, Prashant Goswami, Pritesh Shah, Subhash Shah, Chintan Mehta

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Connection leaks

The following configuration settings can help us to detect connection leaks:

  • removeAbandoned: This flag should be true. It means that abandoned connections are removed if they exceed removeAbandonedTimeout
  • removeAbandonedTimeout: This is in seconds. A connection is considered abandoned if it's running more than removeAbandonedTimeout. The value depends on the longest running query in your applications.

So, in order to get optimal pool sizing, we need to modify our configuration to meet one of following conditions:

<Resource type="javax.sql.DataSource"            name="jdbc/TestDB"            factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"            driverClassName="org.postgresql.Driver"            url="jdbc:postgresql://localhost:5432/TestDB" username="test" ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required