发送一些并发请求时,接近50%的线程处于BLOCKED状态

时间:2018-04-14 15:34:41

标签: tomcat8

tomcat的基本配置如下:

<Executor name="tomcatThreadPool" namePrefix="catalina-exec-" maxThreads="500" minSpareThreads="30" maxIdleTime="60000" prestartminSpareThreads = "true" />

 <Connector port="80" protocol="org.apache.coyote.http11.Http11Nio2Protocol"
    maxThreads="200" minSpareThreads="10" acceptCount="100"
    maxConnections="10000" acceptorThreadCount="4" URIEncoding="UTF-8" redirectPort="8443"/> 

在使用JMeter进行负载测试时,从线程转储日志模拟一些并发用户(如2000),接近50%的线程处于BLOCKED状态,等待锁定相同的资源&lt; 0x00000007401424d0&gt;,如下所示:< / p>

“http-nio2-80-exec-3" #19 daemon prio=5 os_prio=0 tid=0x00007f7090635000 nid=0x6bab waiting for monitor entry [0x00007f70705be000]
   java.lang.Thread.State: BLOCKED (on object monitor)
at org.apache.log4j.Category.callAppenders(Category.java:204)
- waiting to lock <0x00000007401424d0> (a org.apache.log4j.spi.RootLogger)
at org.apache.log4j.Category.forcedLog(Category.java:391)
at org.apache.log4j.Category.info(Category.java:666)

然后找出以下锁定资源&lt; 0x00000007401424d0&gt;的线程,如下所示,任何人都可以帮助看看这里发生了什么?

“http-nio2-80-exec-1" #17 daemon prio=5 os_prio=0 tid=0x00007f7090631000 nid=0x6ba9 runnable [0x00007f70706c0000]
   java.lang.Thread.State: RUNNABLE
at java.io.FileOutputStream.writeBytes(Native Method)
at    java.io.FileOutputStream.write(FileOutputStream.java:326)
at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:221)
at sun.nio.cs.StreamEncoder.implFlushBuffer(StreamEncoder.java:291
  at sun.nio.cs.StreamEncoder.implFlush(StreamEncoder.java:295)
at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:141)
- locked <0x00000007420ef208> (a java.io.OutputStreamWriter)
at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:229)
at org.apache.log4j.helpers.QuietWriter.flush(QuietWriter.java:59)
at org.apache.log4j.WriterAppender.subAppend(WriterAppender.java:324)
at org.apache.log4j.DailyRollingFileAppender.subAppend(DailyRollingFileAppender.java:369)
at org.apache.log4j.WriterAppender.append(WriterAppender.java:162)
at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:251)
- locked <0x0000000741000de8> (a org.apache.log4j.DailyRollingFileAppender)
at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:66)
at org.apache.log4j.Category.callAppenders(Category.java:206)
- locked <0x00000007401424d0> (a org.apache.log4j.spi.RootLogger)
at org.apache.log4j.Category.forcedLog(Category.java:391)
at org.apache.log4j.Category.debug(Category.java:260)

0 个答案:

没有答案