0

I have a mysql database configured with a max_connections value of 150. I also have a Java 6 web application running in Tomcat 5.5 configured with the following setup:

<Resource name="jdbc/myDB"
type="javax.sql.DataSource"
driver="com.mysql.jdbc.Driver"
username="username"
password="password"
maxActive="100"
maxIdle="100"
maxWait="-1"
removeAbandoned="true"
removeAbandonedTimeout="300"
logAbandoned="true"
url="jdbc:mysql://localhost:3306/myDB?autoreconnect=true"
validationQuery="SELECT 1" />

This application is not using any 3rd party framework just basic java servlets. I have a bug in some code in the java app that is not properly releasing opened mysql connections from the pool. I am working on identifying and fixing these. But in the meantime I need to figure out why at most there is only 25 connections being allowed to mysql. After these 25 connections are used up, the application becomes unresponsive.

Can someone please help me figure out why both mysql and tomcat are configured for 100+ connections but it is only allowing 25 at a time?

Preston S
  • 2,751
  • 24
  • 37
  • You may have a database connection pool configured within the app server that manages the reuse of connections. – Rob Dec 05 '14 at 01:23
  • @Rob, I added my connection pool setup to my question, do you see anything wrong with it? – Preston S Dec 05 '14 at 04:36

2 Answers2

0

Tomcat JDBC Connection Pool

What connection pool do you use?

Do you use the Tomcat JDBC Connection Pool, rather than the Apache Commons pool? It has properties to detect connection leaks or abandon connection that are open for a long time than the configured timeout.

Basil Bourque
  • 303,325
  • 100
  • 852
  • 1,154
Andy Dufresne
  • 6,022
  • 7
  • 63
  • 113
0

MySQL's max_connections was set to 150 but the max_user_connections was set to 25 which was the limiting factor here. I removed this setting from my.cnf to restore it to the default value of unlimited.

Preston S
  • 2,751
  • 24
  • 37