Open lujunGit opened 6 years ago
出现的问题: 1:select count(1) from t_bet_order where ORDERNO = ? 频繁查询,导致拒绝连接 也导致了Connection reset by peer这个问题
也引发了com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: 拒绝连接 这个问题,因为使用的是jpa内部维持的连接池对象,会被认为是同一个
2:一个sql经常执行查询,只使用到3个属性,但是返回所有属性,导致耗时较长,出现连接中断异常
3:com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Communications link failure during rollback(). Transaction resolution unknown. mysql等待超时时间设置过短,导致很快超时。
解决: 1:使用原生sql,不适用jpa的find方法
2:只查询3个属性
3:修改mysql配置,调大等待超时时间 show global variables like '%time%' ;
修改配置文件 wait_timeout=280000 innodb_lock_wait_timeout =100
出现的问题: 1:select count(1) from t_bet_order where ORDERNO = ? 频繁查询,导致拒绝连接 也导致了Connection reset by peer这个问题
也引发了com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: 拒绝连接 这个问题,因为使用的是jpa内部维持的连接池对象,会被认为是同一个
2:一个sql经常执行查询,只使用到3个属性,但是返回所有属性,导致耗时较长,出现连接中断异常
3:com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Communications link failure during rollback(). Transaction resolution unknown. mysql等待超时时间设置过短,导致很快超时。