Home > Database > Mysql Tutorial > body text

PAIP.MYSQLSLEEP连接太多解决_MySQL

WBOY
Release: 2016-06-01 13:26:43
Original
1112 people have browsed it

bitsCN.com

PAIP.MYSQL SLEEP 连接太多解决

////////服务器端方法.

-----------------设置mysql自动断开.sleep连接..

MySQL中的配置参数interactive_timeout和wait_timeout(可能导致过多sleep进程的两个参数)

1)interactive_timeout:

参数含义:服务器关闭交互式连接前等待活动的秒数。交互式客户端定义为在mysql_real_connect()中使用CLIENT_INTERACTIVE选项的客户端。

参数默认值:28800秒(8小时)

(2)wait_timeout:

参数含义:服务器关闭非交互连接之前等待活动的秒数。

在线程启动时,根据全局wait_timeout值或全局interactive_timeout值初始化会话wait_timeout值,取决于客户端类型(由mysql_real_connect()的连接选项CLIENT_INTERACTIVE定义)。

参数默认值:28800秒(8小时)

--------------------已经连接上的使用kill掉..

paip.mysql 批量kill 连接.(2013-12-19 09:28)

/////////////客户端方法.

conn并不能自己疏放.除非使用连接池

------------c3p0 数据库池 timeout 设置..minConn=0

7: //Maximum idle time for C3P0 connection pool

8: public static final String C3P0_TIMEOUT = "hibernate.c3p0.timeout";

--------------------手动conn.close

要是没有使用池,只能手动close了..没有参数设置conn的最大时间..

-----------进程结束...自动疏放gc conn

bitsCN.com
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!