我先描述下环境。我们这里有个rss download server。 使用activemq + timertask schual。 每格一个小时运行一次。数据库里大概有6000多个Feed。 rss download server并发30个线程去download feed 然后更新数据库。 可是这几天发现。download server工作不正常。时常是个好几个小时工作一次。或者更本就不工作。常看日志发现。 mysql执行一条update语句都需要十多分钟? 日志请看下面:
Last packet sent to the server was 914670 ms ago.
我想问问, 发生这种情况是不是msyql承受不了这样的压力呢?
sql 代码
- 2007-04-28 10:54:29,415 INFO [STDOUT] Hibernate: update CHANNELS set IS_DOWNLOADING=?, LAST_UPDATED=now() where CHANNEL_ID=?
- 2007-04-28 11:09:26,057 WARN [org.hibernate.util.JDBCExceptionReporter] SQL Error: 0, SQLState: 08S01
- 2007-04-28 11:09:26,550 ERROR [org.hibernate.util.JDBCExceptionReporter] Communications link failure due to underlying exception:
- ** BEGIN NESTED EXCEPTION **
- java.io.EOFException
- STACKTRACE:
- java.io.EOFException
- at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1903)
- at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2402)
- at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2860)
- at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:771)
- at com.mysql.jdbc.MysqlIO.nextRow(MysqlIO.java:1289)
- at com.mysql.jdbc.MysqlIO.readSingleRowSet(MysqlIO.java:2270)
- at com.mysql.jdbc.MysqlIO.getResultSet(MysqlIO.java:423)
- at com.mysql.jdbc.MysqlIO.readResultsForQueryOrUpdate(MysqlIO.java:1960)
- at com.mysql.jdbc.MysqlIO.readAllResults(MysqlIO.java:1385)
- at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1728)
- at com.mysql.jdbc.Connection.execSQL(Connection.java:2978)
- at com.mysql.jdbc.Connection.execSQL(Connection.java:2902)
- at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:933)
- at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1027)
- at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeQuery(WrappedPreparedStatement.java:211)
- at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:139)
- at org.hibernate.loader.Loader.getResultSet(Loader.java:1669)
- at org.hibernate.loader.Loader.doQuery(Loader.java:662)
- at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
- at org.hibernate.loader.Loader.loadCollection(Loader.java:1919)
- at org.hibernate.loader.collection.CollectionLoader.initialize(CollectionLoader.java:36)
- at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:520)
- at org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:60)
- at org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1676)
- at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:344)
- at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86)
- at org.hibernate.collection.PersistentBag.iterator(PersistentBag.java:246)
- at com.monitor110.rss.download.service.DownloadServiceDaoHibernateImpl.isNewItem(DownloadServiceDaoHibernateImpl.java:163)
- at com.monitor110.rss.download.service.DownloadServiceDaoHibernateImpl.checkAndSaveNewItems(DownloadServiceDaoHibernateImpl.java:221)
- at com.monitor110.rss.download.service.DownloadServiceDaoHibernateImpl.access$100(DownloadServiceDaoHibernateImpl.java:44)
- at com.monitor110.rss.download.service.DownloadServiceDaoHibernateImpl$2.doInHibernate(DownloadServiceDaoHibernateImpl.java:137)
- at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:367)
- at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:333)
- at com.monitor110.rss.download.service.DownloadServiceDaoHibernateImpl.save(DownloadServiceDaoHibernateImpl.java:118)
- at com.monitor110.rss.download.service.DownloadServiceImpl.persist(DownloadServiceImpl.java:41)
- at sun.reflect.GeneratedMethodAccessor168.invoke(Unknown Source)
- at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
- at java.lang.reflect.Method.invoke(Method.java:585)
- at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:299)
- at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:172)
- at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:139)
- at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
- at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161)
- at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
- at $Proxy84.persist(Unknown Source)
- at com.monitor110.rss.download.service.DownloadResultConsumer.onMessage(DownloadResultConsumer.java:28)
- at org.jencks.LocalTransactionEndpoint.onMessage(LocalTransactionEndpoint.java:68)
- at org.apache.activemq.ra.MessageEndpointProxy$MessageEndpointAlive.onMessage(MessageEndpointProxy.java:121)
- at org.apache.activemq.ra.MessageEndpointProxy.onMessage(MessageEndpointProxy.java:61)
- at org.apache.activemq.ActiveMQSession.run(ActiveMQSession.java:695)
- at org.apache.activemq.ra.ServerSessionImpl.run(ServerSessionImpl.java:165)
- at org.apache.geronimo.connector.work.WorkerContext.run(WorkerContext.java:291)
- at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(Unknown Source)
- at java.lang.Thread.run(Thread.java:595)
- ** END NESTED EXCEPTION **
- Last packet sent to the server was 914670 ms ago.
- 2007-04-28 11:09:27,882 ERROR [com.monitor110.rss.download.service.DownloadResultConsumer] Can't save download result
- org.springframework.dao.DataAccessResourceFailureException: could not initialize a collection: [com.monitor110.rss.domain.Channel.items#12686]; nested exception is org.hibernate.exception.JDBCConnectionException: could not initialize a collection: [com.monitor110.rss.domain.Channel.items#12686]
- Caused by:
- org.hibernate.exception.JDBCConnectionException: could not initialize a collection: [com.monitor110.rss.domain.Channel.items#12686]
- at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:74)
- at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
- at org.hibernate.loader.Loader.loadCollection(Loader.java:1926)
- at org.hibernate.loader.collection.CollectionLoader.initialize(CollectionLoader.java:36)
- at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:520)
- at org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:60)
- at org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1676)
- at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:344)
- at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86)
- at org.hibernate.collection.PersistentBag.iterator(PersistentBag.java:246)
- at com.monitor110.rss.download.service.DownloadServiceDaoHibernateImpl.isNewItem(DownloadServiceDaoHibernateImpl.java:163)
- at com.monitor110.rss.download.service.DownloadServiceDaoHibernateImpl.checkAndSaveNewItems(DownloadServiceDaoHibernateImpl.java:221)
- at com.monitor110.rss.download.service.DownloadServiceDaoHibernateImpl.access$100(DownloadServiceDaoHibernateImpl.java:44)
- at com.monitor110.rss.download.service.DownloadServiceDaoHibernateImpl$2.doInHibernate(DownloadServiceDaoHibernateImpl.java:137)
- at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:367)
- at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:333)
- at com.monitor110.rss.download.service.DownloadServiceDaoHibernateImpl.save(DownloadServiceDaoHibernateImpl.java:118)
- at com.monitor110.rss.download.service.DownloadServiceImpl.persist(DownloadServiceImpl.java:41)
- at sun.reflect.GeneratedMethodAccessor168.invoke(Unknown Source)
- at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
- at java.lang.reflect.Method.invoke(Method.java:585)
- at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:299)
- at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:172)
- at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:139)
- at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
- at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161)
- at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
- at $Proxy84.persist(Unknown Source)
- at com.monitor110.rss.download.service.DownloadResultConsumer.onMessage(DownloadResultConsumer.java:28)
- at org.jencks.LocalTransactionEndpoint.onMessage(LocalTransactionEndpoint.java:68)
- at org.apache.activemq.ra.MessageEndpointProxy$MessageEndpointAlive.onMessage(MessageEndpointProxy.java:121)
- at org.apache.activemq.ra.MessageEndpointProxy.onMessage(MessageEndpointProxy.java:61)
- at org.apache.activemq.ActiveMQSession.run(ActiveMQSession.java:695)
- at org.apache.activemq.ra.ServerSessionImpl.run(ServerSessionImpl.java:165)
- at org.apache.geronimo.connector.work.WorkerContext.run(WorkerContext.java:291)
- at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(Unknown Source)
- at java.lang.Thread.run(Thread.java:595)
- Caused by: com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:
- ** BEGIN NESTED EXCEPTION **
- java.io.EOFException
- STACKTRACE:
- java.io.EOFException
- at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1903)
- at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2402)
- at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2860)
- at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:771)
- at com.mysql.jdbc.MysqlIO.nextRow(MysqlIO.java:1289)
- at com.mysql.jdbc.MysqlIO.readSingleRowSet(MysqlIO.java:2270)
- at com.mysql.jdbc.MysqlIO.getResultSet(MysqlIO.java:423)
- at com.mysql.jdbc.MysqlIO.readResultsForQueryOrUpdate(MysqlIO.java:1960)
- at com.mysql.jdbc.MysqlIO.readAllResults(MysqlIO.java:1385)
- at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1728)
- at com.mysql.jdbc.Connection.execSQL(Connection.java:2978)
- at com.mysql.jdbc.Connection.execSQL(Connection.java:2902)
- at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:933)
- at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1027)
- at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeQuery(WrappedPreparedStatement.java:211)
- at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:139)
- at org.hibernate.loader.Loader.getResultSet(Loader.java:1669)
- at org.hibernate.loader.Loader.doQuery(Loader.java:662)
- at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
- at org.hibernate.loader.Loader.loadCollection(Loader.java:1919)
- at org.hibernate.loader.collection.CollectionLoader.initialize(CollectionLoader.java:36)
- at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:520)
- at org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:60)
- at org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1676)
- at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:344)
- at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86)
- at org.hibernate.collection.PersistentBag.iterator(PersistentBag.java:246)
- at com.monitor110.rss.download.service.DownloadServiceDaoHibernateImpl.isNewItem(DownloadServiceDaoHibernateImpl.java:163)
- at com.monitor110.rss.download.service.DownloadServiceDaoHibernateImpl.checkAndSaveNewItems(DownloadServiceDaoHibernateImpl.java:221)
- at com.monitor110.rss.download.service.DownloadServiceDaoHibernateImpl.access$100(DownloadServiceDaoHibernateImpl.java:44)
- at com.monitor110.rss.download.service.DownloadServiceDaoHibernateImpl$2.doInHibernate(DownloadServiceDaoHibernateImpl.java:137)
- at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:367)
- at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:333)
- at com.monitor110.rss.download.service.DownloadServiceDaoHibernateImpl.save(DownloadServiceDaoHibernateImpl.java:118)
- at com.monitor110.rss.download.service.DownloadServiceImpl.persist(DownloadServiceImpl.java:41)
- at sun.reflect.GeneratedMethodAccessor168.invoke(Unknown Source)
- at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
- at java.lang.reflect.Method.invoke(Method.java:585)
- at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:299)
- at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:172)
- at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:139)
- at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
- at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161)
- at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
- at $Proxy84.persist(Unknown Source)
- at com.monitor110.rss.download.service.DownloadResultConsumer.onMessage(DownloadResultConsumer.java:28)
- at org.jencks.LocalTransactionEndpoint.onMessage(LocalTransactionEndpoint.java:68)
- at org.apache.activemq.ra.MessageEndpointProxy$MessageEndpointAlive.onMessage(MessageEndpointProxy.java:121)
- at org.apache.activemq.ra.MessageEndpointProxy.onMessage(MessageEndpointProxy.java:61)
- at org.apache.activemq.ActiveMQSession.run(ActiveMQSession.java:695)
- at org.apache.activemq.ra.ServerSessionImpl.run(ServerSessionImpl.java:165)
- at org.apache.geronimo.connector.work.WorkerContext.run(WorkerContext.java:291)
- at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(Unknown Source)
- at java.lang.Thread.run(Thread.java:595)
- ** END NESTED EXCEPTION **
- Last packet sent to the server was 914670 ms ago.
- at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2561)
- at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2860)
- at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:771)
- at com.mysql.jdbc.MysqlIO.nextRow(MysqlIO.java:1289)
- at com.mysql.jdbc.MysqlIO.readSingleRowSet(MysqlIO.java:2270)
- at com.mysql.jdbc.MysqlIO.getResultSet(MysqlIO.java:423)
- at com.mysql.jdbc.MysqlIO.readResultsForQueryOrUpdate(MysqlIO.java:1960)
- at com.mysql.jdbc.MysqlIO.readAllResults(MysqlIO.java:1385)
- at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1728)
- at com.mysql.jdbc.Connection.execSQL(Connection.java:2978)
- at com.mysql.jdbc.Connection.execSQL(Connection.java:2902)
- at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:933)
- at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1027)
- at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeQuery(WrappedPreparedStatement.java:211)
- at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:139)
- at org.hibernate.loader.Loader.getResultSet(Loader.java:1669)
- at org.hibernate.loader.Loader.doQuery(Loader.java:662)
- at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
- at org.hibernate.loader.Loader.loadCollection(Loader.java:1919)
- ... 34 more
- 2007-04-28 11:09:28,956 INFO [STDOUT] Hibernate: insert into DOWNLOAD_EVENTS (EVENT_TIME, EVENT_TYPE, CHANNEL_URL, ERROR_MESSAGE, FEED_TITLE, EVENT_CATEGORY, CHANNEL_ID) values (?, ?, ?, ?, ?, ?, ?)
- 2007-04-28 11:09:46,123 WARN [org.apache.commons.httpclient.HttpMethodBase] Cookie rejected: "$Version=0; cookieb2evosession=325238_kTKG95W2UgwnpNYoFDmTgALummwkBqbY; $Path=/; $Domain=.www.seeisee.com". Illegal domain attribute ".www.seeisee.com". Domain of origin: "www.seeisee.com"
- 2007-04-28 11:09:49,692 ERROR [org.hibernate.transaction.JDBCTransaction] JDBC commit failed
- java.sql.SQLException: Can't call commit when autocommit=true
- at com.mysql.jdbc.Connection.commit(Connection.java:2145)
- at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.jdbcCommit(BaseWrapperManagedConnection.java:436)
- at org.jboss.resource.adapter.jdbc.WrappedConnection.commit(WrappedConnection.java:331)
- at org.hibernate.transaction.JDBCTransaction.commitAndResetAutoCommit(JDBCTransaction.java:139)
- at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:115)
- at org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:570)
- at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:651)
- at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:621)
- at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:311)
- at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:117)
- at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161)
- at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
- at $Proxy84.persist(Unknown Source)
- at com.monitor110.rss.download.service.DownloadResultConsumer.onMessage(DownloadResultConsumer.java:39)
- at org.jencks.LocalTransactionEndpoint.onMessage(LocalTransactionEndpoint.java:68)
- at org.apache.activemq.ra.MessageEndpointProxy$MessageEndpointAlive.onMessage(MessageEndpointProxy.java:121)
- at org.apache.activemq.ra.MessageEndpointProxy.onMessage(MessageEndpointProxy.java:61)
- at org.apache.activemq.ActiveMQSession.run(ActiveMQSession.java:695)
- at org.apache.activemq.ra.ServerSessionImpl.run(ServerSessionImpl.java:165)
- at org.apache.geronimo.connector.work.WorkerContext.run(WorkerContext.java:291)
- at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(Unknown Source)
- at java.lang.Thread.run(Thread.java:595)
- 2007-04-28 11:09:50,219 INFO [STDOUT] Hibernate: update CHANNELS set IS_DOWNLOADING=?, LAST_UPDATED=now() where CHANNEL_ID=?
- 2007-04-28 10:54:29,415 INFO [STDOUT] Hibernate: update CHANNELS set IS_DOWNLOADING=?, LAST_UPDATED=now() where CHANNEL_ID=?
- 2007-04-28 11:09:26,057 WARN [org.hibernate.util.JDBCExceptionReporter] SQL Error: 0, SQLState: 08S01
Last packet sent to the server was 914670 ms ago.
我想问问, 发生这种情况是不是msyql承受不了这样的压力呢?