durui+oracle做业务压力测试,druid出现出现大量线程等待

野渡无人舟自横 发布于 2016/10/14 18:20
阅读 1K+
收藏 0

  大家好,请教个问题。单笔交易有5~7次数据库操作,在500个并发的情况下线程dump开始大量出现这个waiting

"Thread-22496" - Thread t@22525
   java.lang.Thread.State: WAITING
	at sun.misc.Unsafe.park(Native Method)
	- parking to wait for <42e75b39> (a java.util.concurrent.locks.ReentrantLock$FairSync)
	at java.util.concurrent.locks.LockSupport.park(LockSupport.java:156)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:811)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireInterruptibly(AbstractQueuedSynchronizer.java:867)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireInterruptibly(AbstractQueuedSynchronizer.java:1201)
	at java.util.concurrent.locks.ReentrantLock.lockInterruptibly(ReentrantLock.java:312)
	at com.alibaba.druid.pool.DruidDataSource.recycle(DruidDataSource.java:1332)
	at com.alibaba.druid.pool.DruidPooledConnection.recycle(DruidPooledConnection.java:305)
	at com.alibaba.druid.filter.FilterChainImpl.dataSource_recycle(FilterChainImpl.java:4534)
	at com.alibaba.druid.filter.stat.StatFilter.dataSource_releaseConnection(StatFilter.java:647)
	at com.alibaba.druid.filter.FilterChainImpl.dataSource_recycle(FilterChainImpl.java:4530)
	at com.alibaba.druid.pool.DruidPooledConnection.syncClose(DruidPooledConnection.java:282)
	- locked <3ccb1d1c> (a com.alibaba.druid.pool.DruidPooledConnection)
	at com.alibaba.druid.pool.DruidPooledConnection.close(DruidPooledConnection.java:241)
	at org.springframework.jdbc.datasource.DataSourceUtils.doCloseConnection(DataSourceUtils.java:341)
	at org.springframework.jdbc.datasource.DataSourceUtils.doReleaseConnection(DataSourceUtils.java:328)
	at org.springframework.jdbc.datasource.DataSourceUtils.releaseConnection(DataSourceUtils.java:294)
	at org.springframework.jdbc.datasource.DataSourceTransactionManager.doCleanupAfterCompletion(DataSourceTransactionManager.java:326)
	at org.springframework.transaction.support.AbstractPlatformTransactionManager.cleanupAfterCompletion(AbstractPlatformTransactionManager.java:1012)
	at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:807)
	at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:726)
	at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:478)
	at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:272)
	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:95)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
	at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:644)
	
	at java.lang.Thread.run(Thread.java:662)

   Locked ownable synchronizers:
	- None

"Thread-22495" - Thread t@22524
   java.lang.Thread.State: WAITING
	at sun.misc.Unsafe.park(Native Method)
	- parking to wait for <42e75b39> (a java.util.concurrent.locks.ReentrantLock$FairSync)
	at java.util.concurrent.locks.LockSupport.park(LockSupport.java:156)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:811)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireInterruptibly(AbstractQueuedSynchronizer.java:867)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireInterruptibly(AbstractQueuedSynchronizer.java:1201)
	at java.util.concurrent.locks.ReentrantLock.lockInterruptibly(ReentrantLock.java:312)
	at com.alibaba.druid.pool.DruidDataSource.recycle(DruidDataSource.java:1332)
	at com.alibaba.druid.pool.DruidPooledConnection.recycle(DruidPooledConnection.java:305)
	at com.alibaba.druid.filter.FilterChainImpl.dataSource_recycle(FilterChainImpl.java:4534)
	at com.alibaba.druid.filter.stat.StatFilter.dataSource_releaseConnection(StatFilter.java:647)
	at com.alibaba.druid.filter.FilterChainImpl.dataSource_recycle(FilterChainImpl.java:4530)
	at com.alibaba.druid.pool.DruidPooledConnection.syncClose(DruidPooledConnection.java:282)
	- locked <74e69d28> (a com.alibaba.druid.pool.DruidPooledConnection)
	at com.alibaba.druid.pool.DruidPooledConnection.close(DruidPooledConnection.java:241)
	at org.springframework.jdbc.datasource.DataSourceUtils.doCloseConnection(DataSourceUtils.java:341)
	at org.springframework.jdbc.datasource.DataSourceUtils.doReleaseConnection(DataSourceUtils.java:328)
	at org.springframework.jdbc.datasource.DataSourceUtils.releaseConnection(DataSourceUtils.java:294)
	at org.springframework.jdbc.datasource.DataSourceTransactionManager.doCleanupAfterCompletion(DataSourceTransactionManager.java:326)
	at org.springframework.transaction.support.AbstractPlatformTransactionManager.cleanupAfterCompletion(AbstractPlatformTransactionManager.java:1012)
	at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:807)
	at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:726)
	at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:478)
	at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:272)
	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:95)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
	at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:644)
	at com.ofsp.fats.svr.handler.service.Service7101$$EnhancerBySpringCGLIB$$7d2ea33a.addSerial(<generated>)

	at java.lang.Thread.run(Thread.java:662)

   Locked ownable synchronizers:
	- None

druid配置:

<!-- 配置初始化大小、最小、最大 -->
		<property name="initialSize" value="1" />
		<property name="minIdle" value="50" /> 
		<property name="maxActive" value="200" />
		
		<!-- 配置获取连接等待超时的时间 -->
		<property name="maxWait" value="60000" />
		
		<!-- 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 -->
		<property name="timeBetweenEvictionRunsMillis" value="60000" />
		
		<!-- 配置一个连接在池中最小生存的时间,单位是毫秒 -->
		<property name="minEvictableIdleTimeMillis" value="300000" />
		
		<property name="validationQuery" value="${jdbc.testSql}" />
		<property name="testWhileIdle" value="true" />
		<property name="testOnBorrow" value="false" />
		<property name="testOnReturn" value="false" />
		
		<!-- 打开removeAbandoned功能 -->
		<property name="removeAbandoned" value="true" />
		<!-- 1800秒,也就是30分钟 -->
		<property name="removeAbandonedTimeout" value="1800" />
		<!-- 关闭abanded连接时输出错误日志 -->
		<property name="logAbandoned" value="true" />



这是哪里的瓶颈呢....





加载中
0
爪哇小贩
爪哇小贩

高并发应用推荐HikariCP,官网https://github.com/brettwooldridge/HikariCP。性能排名第一,长期运行可靠性也很高。我已经替换了druid

yqz323
yqz323
@DelphiSa 回复@DelphiSa : 今天生产上也碰到了这个问题,这个可能是什么导致的?
D
DelphiSa
回复 @wenshao : 当时Druid报错无法取得数据库连接池
D
DelphiSa
回复 @wenshao : 原先我使用Druid在生产环境,当服务器网络不稳定后Druid查询超慢,网络恢复后也查询超慢,只能重启服务器,后来用C3P0无此现象
野渡无人舟自横
野渡无人舟自横
回复 @wenshao :谢谢,去找下问题~~
wenshao
wenshao
不懂就不要乱说,这个是SQL执行慢导致链接不够用了。
下一页
0
求是科技
求是科技

很明显是单台数据库的瓶颈撒,解决方法

1:加缓存,2:配置多台数据库。

求是科技
求是科技
回复 @子非鱼_233 : 那就多搞几台数据库撒,分散你这500的并发量。
野渡无人舟自横
野渡无人舟自横
缓存有的,这几个sql都是更新或者插入的
0
IdleMan
IdleMan

如果是数据库瓶颈一般会报错ORA-XXX,比如:

无法从数据库获取连接;
创建连接超时;

返回顶部
顶部