1. 程式人生 > >MySQL優化Timeout: Pool empty. Unable to fetch a connection in 30 seconds, none available

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

設置 val ict proc time remove 鎖定 lock nds

//查看所有進程
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

  

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