Tomcat线程卡住了从客户端读取有效负载

时间:2017-02-07 20:29:53

标签: multithreading tomcat servlets networking servlet-3.0

我们的应用服务器在Tomcat上运行,默认连接器和200个线程。通常在任何给定时间平均只有4-10个繁忙,但是注意到在所有200个线程都忙着。在分析了线程转储后,发现所有线程都忙于从客户端读取。需要有关了解线程转储和任何线索的指导。感谢

http线程卡在2个类似的堆栈跟踪中(粘贴在下面的A和B)。堆栈A的线程数为171,线程B的堆栈数为29.组线程在跟踪中没有应用程序,B组线程跟踪确实有应用程序类(XZYServlet)。

  

我认为这是由于网络速度慢,因此线程正在忙着阅读后有效负载。还有其他线索吗?

  1. 由于我们运行的是200个线程,因此所有线程都不应该跟踪跟踪中的应用程序类吗?即B型螺纹堆栈
  2. 任何想法为什么线程会被A类痕迹卡住?
  3. 为什么所有线程都会被堆栈跟踪困住的任何其他原因?
  4. 由于我们有多个servlet,我想在每个servlet上分配有限数量的线程来解决所有线程忙于为1个servlet服务的问题。但是,由于并非所有线程都被卡在servlet中,我不确定。解决此类问题的任何其他想法或可能的选择?
  5.   

    A)没有应用程序类的跟踪

    http-bio-8000-exec-244" #5779 daemon prio=5 os_prio=0 tid=0x00007f9d68010800 nid=0x31e9 runnable [0x00007f9d165c5000] (171 thread)
       java.lang.Thread.State: RUNNABLE
            at java.net.SocketInputStream.socketRead0(Native Method)
            at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
            at java.net.SocketInputStream.read(SocketInputStream.java:170)
            at java.net.SocketInputStream.read(SocketInputStream.java:141)
            at org.apache.coyote.http11.InternalInputBuffer.fill(InternalInputBuffer.java:526)
            at org.apache.coyote.http11.InternalInputBuffer.fill(InternalInputBuffer.java:511)
            at org.apache.coyote.http11.Http11Processor.setRequestLineReadTimeout(Http11Processor.java:168)
            at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1010)
            at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637)
            at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
            - locked <0x00000007bf5c99b8> (a org.apache.tomcat.util.net.SocketWrapper)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
            at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
            at java.lang.Thread.run(Thread.java:745)
    
      

    B)跟踪堆栈中的应用程序类(XZYServlet)

    http-bio-8000-exec-250" #5785 daemon prio=5 os_prio=0 tid=0x00007f9d68091800 nid=0x31ef runnable [0x00007f9d157b8000] (29 Thread)
       java.lang.Thread.State: RUNNABLE
        at java.net.SocketInputStream.socketRead0(Native Method)
        at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
        at java.net.SocketInputStream.read(SocketInputStream.java:170)
        at java.net.SocketInputStream.read(SocketInputStream.java:141)
        at org.apache.coyote.http11.InternalInputBuffer.fill(InternalInputBuffer.java:542)
        at org.apache.coyote.http11.InternalInputBuffer.fill(InternalInputBuffer.java:511)
        at org.apache.coyote.http11.InternalInputBuffer$InputStreamInputBuffer.doRead(InternalInputBuffer.java:573)
        at org.apache.coyote.http11.filters.IdentityInputFilter.doRead(IdentityInputFilter.java:137)
        at org.apache.coyote.http11.AbstractInputBuffer.doRead(AbstractInputBuffer.java:287)
        at org.apache.coyote.Request.doRead(Request.java:438)
        at org.apache.catalina.connector.InputBuffer.realReadBytes(InputBuffer.java:290)
        at org.apache.catalina.connector.InputBuffer.realReadChars(InputBuffer.java:353)
        at org.apache.tomcat.util.buf.CharChunk.substract(CharChunk.java:439)
        at org.apache.catalina.connector.InputBuffer.read(InputBuffer.java:416)
        at org.apache.catalina.connector.CoyoteReader.read(CoyoteReader.java:101)
        at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1485)
        at org.apache.commons.io.IOUtils.copy(IOUtils.java:1461)
        at org.apache.commons.io.IOUtils.toString(IOUtils.java:602)
        at com.ParserUtils.getJsonObject(ParserUtils.java:500)
        at com.XZYServlet.doGet(XZYServlet.java:156)
        at com.XZYServlet.doPost(XZYServlet.java:99)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:650)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:218)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:958)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:452)
        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1099)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637)
        at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
        - locked <0x00000007bfb43350> (a org.apache.tomcat.util.net.SocketWrapper)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
        at java.lang.Thread.run(Thread.java:745)
    

0 个答案:

没有答案