2013-10-01 43 views
0

我有简单的spring + hibernate + mysql项目。打开mysql服务器上的查询日志,我看到许多频繁的“SET autocommit = 0; commit; SET autocommit = 0”语句,而没有在我的应用程序上执行任何操作。很多mysql + hibernate中的空sql语句

哪个进程/为什么我的应用程序正在执行这些频繁的查询?我已经列出了连接池配置。

请注意:

  • 平常SQL查询(从我的应用程序)正在这里
  • 记录这些日志像每1-4秒的非常频繁。
  • 如果我取消部署我的应用程序的所有这些 “SET自动提交= 0; COMMIT; SET 自动提交= 0” 的日志将停止

    131001 10时41分31秒2046查询中设置自动提交= 0 2046查询提交 2046查询SET自动提交= 1个 2046查询SET自动提交= 0 2046查询提交 2046查询SET自动提交= 1个 2046查询SET自动提交= 0 2046查询提交 2046查询SET自动提交= 1 2061查询SET自动提交= 0 2061查询提交 2061查询SET自动提交= 1个 2061查询SET自动提交= 0 2061查询提交 2061查询SET自动提交= 1个 2061查询SET自动提交= 0 2061查询提交 2061查询SET自动提交= 1 131001 10 :41:34 2051查询SET自动提交= 0 2051查询提交 2051查询SET自动提交= 1个 2051查询SET自动提交= 0 2051查询提交 2051查询SET自动提交= 1个 2051查询SET自动提交= 0 2051查询提交 2051查询集自动提交= 1 2047查询中设置自动提交= 0

    <bean id="dataSource" class="com.jolbox.bonecp.BoneCPDataSource" destroy-method="close"> 
        <property name="driverClass" value="com.mysql.jdbc.Driver" /> 
        <property name="jdbcUrl" value="" /> 
        <property name="username" value="..."/> 
        <property name="password" value="..."/> 
        <property name="idleConnectionTestPeriodInMinutes" value="60"/> 
        <property name="idleMaxAgeInMinutes" value="240"/>  
        <property name="maxConnectionsPerPartition" value="30"/> 
        <property name="minConnectionsPerPartition" value="5"/> 
        <property name="partitionCount" value="3"/> 
        <property name="acquireIncrement" value="5"/>        
        <property name="statementsCacheSize" value="300"/> 
        <property name="releaseHelperThreads" value="3"/> 
        <property name="connectionTestStatement" value="/* ping *\/ SELECT 8"/> 
    
    </bean> 
    

回答

1

当你的应用程序启动一个事务这些日志输出。尝试使用jstack转储堆栈跟踪,并查看哪些线程以及何时打开事务。

一些参考:

innodb and autocommit
jstack