MySQL connections not closing

I have a web application running on Tomcat7 that connects to MySQL 5.5.

I have two servers with the same code:

  • Ubuntu

  • Red Hat

Ubuntu works fine with 8-16 persistent connections, but Red Hat merges connections and the number of connections grows, never going down. The server eventually drops ~ 152 connections.

The code is called to close the connection:

try {
    conn.close();           
} catch (SQLException e) {
    exceptionController.logException(this.getClass().getSimpleName(), "finalize Db", e.getMessage(), false);
}finally{
    conn = null;
}

      

All connections to MySQL from this application.

Why is there a difference in behavior? Are there configuration options that I should be aware of - like closing the sleeping connection settings ?

Ubuntu Server Status:

enter image description here

Red Hat server status:

MySQLWorkbench Server Status Screen

Partial netlist screen: MySQLWorkbench Server Connection List

I found this post that seems to have slowed down o / s connections, but they are still crawling.

EDIT

Research indicates improper closing of connections. Why would connections be closed in one environment but not another?

I edited my.cnf

with the following setting:

wait_timeout=30

      

However, client connections slept and never die. The server was restarted with a new setting.

What? I do not understand?

+3


source to share


1 answer


I found a solution. XP on SO Database Administrators .

RedHat has its own mysql folders:



[root@localhost ~]# locate my.cnf
/etc/my.cnf
/opt/rh/mysql55/root/etc/my.cnf

      

It was a config issue and my config file was not being used!

+1


source







All Articles