MySQL優化Timeout: Pool empty. Unable to fetch a connection in 30 seconds, none available

//查看全部進程
show processlist;

//查詢是否鎖表
show OPEN TABLES where In_use > 0;

//查看被鎖住的
SELECT * FROM INFORMATION_SCHEMA.INNODB_LOCKS; 
//等待鎖定
SELECT * FROM INFORMATION_SCHEMA.INNODB_LOCK_WAITS; 
kill 12041

 

#鏈接池最大鏈接數
spring.datasource.max-active=200
#空閒池中最大鏈接數
spring.datasource.max-idle=50
#空閒池中最小鏈接數
spring.datasource.min-idle=10
spring.datasource.initial-size=10
#鏈接在池中空閒最小時間後被清除
spring.datasource.min-evictable-idle-time-millis=60000
#隔多久時間清回收廢棄鏈接
spring.datasource.time-between-eviction-runs-millis=30000
#每次調用檢測池裏鏈接的可用性,假如鏈接池中的鏈接被數據庫關閉了,應用經過鏈接池getConnection時會從新建立
spring.datasource.testOnBorrow=true
spring.datasource.validation-query=SELECT 1
#移除被遺棄的鏈接
spring.datasource.remove-abandoned=true
#設置超時時間
spring.datasource.tomcat.remove-abandoned-timeout=60
相關文章
相關標籤/搜索