java - Basicdatasource connection time out problem (using mysql) -
i using basicdatasource in application. application processing huge amount of raw data. 1 query can take more 15 minutes. (using mysql db)
here question, acquire connection pool, execute several queries on it. when use same connection more 15 minutes, error below. in mysql server max_wait set 180 hours shouldn t problem keep connection alive , no firewall rule set kill connections alive more amount of time.
what missing here think ?
the last packet received server 928,374 milliseconds ago. last packet sent server 928,374 milliseconds ago. @ sun.reflect.nativeconstructoraccessorimpl.newinstance0(native method) @ sun.reflect.nativeconstructoraccessorimpl.newinstance(nativeconstructoraccessorimpl.java:39) @ sun.reflect.delegatingconstructoraccessorimpl.newinstance(delegatingconstructoraccessorimpl.java:27) @ java.lang.reflect.constructor.newinstance(constructor.java:513) @ com.mysql.jdbc.util.handlenewinstance(util.java:409) @ com.mysql.jdbc.sqlerror.createcommunicationsexception(sqlerror.java:1118) @ com.mysql.jdbc.mysqlio.reuseandreadpacket(mysqlio.java:3055) @ com.mysql.jdbc.mysqlio.reuseandreadpacket(mysqlio.java:2941) @ com.mysql.jdbc.mysqlio.checkerrorpacket(mysqlio.java:3489) @ com.mysql.jdbc.mysqlio.sendcommand(mysqlio.java:1959) @ com.mysql.jdbc.mysqlio.sqlquerydirect(mysqlio.java:2113) @ com.mysql.jdbc.connectionimpl.execsql(connectionimpl.java:2562) @ com.mysql.jdbc.statementimpl.executeupdate(statementimpl.java:1664) @ com.mysql.jdbc.statementimpl.executeupdate(statementimpl.java:1583) @ org.apache.commons.dbcp.delegatingstatement.executeupdate(delegatingstatement.java:228) @ org.apache.commons.dbcp.delegatingstatement.executeupdate(delegatingstatement.java:228) @ com.adsclick.logs.cron.adsclickv261.global.processbase.executeupdate(processbase.java:766)
things can try:
setmaxwait(-1)
on basicdatasource. tells wait indefinitely connection.check
wait_timeout
on mysql server set default 8h.set
?autoreconnect=true
on jdbc urlsettestonborrow(true)
on basicdatasource. prevent handing out stale connections add overhead app (though if you've got such long single queries won't notice part).
in general, find bad idea keep re-using connection. me, point of having pool don't have that.
are queries transactional? long query locking major table?
Comments
Post a Comment