jetty-9 TIMED_WAITING(停车)状态

时间:2016-03-19 14:03:02

标签: java multithreading jetty spring-websocket jetty-9

我有一个部署在jetty服务器上的应用程序。 Jetty独立服务器具有默认配置。应用程序包含基于弹簧的websocket。

客户端使用Web套接字连接连接到服务器。 建立连接后,客户端每5秒发送一次心跳消息,并发送一些请求,例如请求特定数据。

当客户端打开连接而不发送任何心跳消息或特定请求时,我可以打开任意数量的连接(尝试高达10000)

另一方面,当所有线程都被打开并开始并行发送心跳消息和特定请求时,服务器被挂起并且不再能够接受大于2000的连接。

Jetty Server版本:jetty-distribution-9.3.8.v20160314

但在2000连接后,只有应用程序被挂起 使用jstack进行了线程转储,结果如下:

" qtp1143839598-216" #216 prio = 5 os_prio = 0 tid = 0x00007fcd88017000 nid = 0x7365等待条件[0x00007fcd344c3000]    java.lang.Thread.State:TIMED_WAITING(停车)     在sun.misc.Unsafe.park(原生方法)      - 停车等待< 0x00000000850d7fb0> (java.util.concurrent.locks.AbstractQueuedSynchronizer $ ConditionObject)     at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215)     at java.util.concurrent.locks.AbstractQueuedSynchronizer $ ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2078)     在org.eclipse.jetty.util.BlockingArrayQueue.poll(BlockingArrayQueue.java:392)     at org.eclipse.jetty.util.thread.QueuedThreadPool.idleJobPoll(QueuedThreadPool.java:546)     在org.eclipse.jetty.util.thread.QueuedThreadPool.access $ 800(QueuedThreadPool.java:47)     在org.eclipse.jetty.util.thread.QueuedThreadPool $ 3.run(QueuedThreadPool.java:609)     在java.lang.Thread.run(Thread.java:745)

" qtp1143839598-215" #215 prio = 5 os_prio = 0 tid = 0x00007fcd8c01c000 nid = 0x7364等待条件[0x00007fcd345c4000]    java.lang.Thread.State:TIMED_WAITING(停车)     在sun.misc.Unsafe.park(原生方法)      - 停车等待< 0x00000000850d7fb0> (java.util.concurrent.locks.AbstractQueuedSynchronizer $ ConditionObject)     at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215)     at java.util.concurrent.locks.AbstractQueuedSynchronizer $ ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2078)     在org.eclipse.jetty.util.BlockingArrayQueue.poll(BlockingArrayQueue.java:392)     at org.eclipse.jetty.util.thread.QueuedThreadPool.idleJobPoll(QueuedThreadPool.java:546)     在org.eclipse.jetty.util.thread.QueuedThreadPool.access $ 800(QueuedThreadPool.java:47)     在org.eclipse.jetty.util.thread.QueuedThreadPool $ 3.run(QueuedThreadPool.java:609)     在java.lang.Thread.run(Thread.java:745)

" qtp1143839598-214" #214 prio = 5 os_prio = 0 tid = 0x00007fcd805ea800 nid = 0x735f等待条件[0x00007fcd346c5000]    java.lang.Thread.State:TIMED_WAITING(停车)     在sun.misc.Unsafe.park(原生方法)      - 停车等待< 0x00000000850d7fb0> (java.util.concurrent.locks.AbstractQueuedSynchronizer $ ConditionObject)     at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215)     at java.util.concurrent.locks.AbstractQueuedSynchronizer $ ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2078)     在org.eclipse.jetty.util.BlockingArrayQueue.poll(BlockingArrayQueue.java:392)     at org.eclipse.jetty.util.thread.QueuedThreadPool.idleJobPoll(QueuedThreadPool.java:546)     在org.eclipse.jetty.util.thread.QueuedThreadPool.access $ 800(QueuedThreadPool.java:47)     在org.eclipse.jetty.util.thread.QueuedThreadPool $ 3.run(QueuedThreadPool.java:609)     在java.lang.Thread.run(Thread.java:745)

" qtp1143839598-213" #213 prio = 5 os_prio = 0 tid = 0x00007fcd84135000 nid = 0x7358等待条件[0x00007fcd347c6000]    java.lang.Thread.State:TIMED_WAITING(停车)     在sun.misc.Unsafe.park(原生方法)      - 停车等待< 0x00000000850d7fb0> (java.util.concurrent.locks.AbstractQueuedSynchronizer $ ConditionObject)     at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215)     at java.util.concurrent.locks.AbstractQueuedSynchronizer $ ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2078)     在org.eclipse.jetty.util.BlockingArrayQueue.poll(BlockingArrayQueue.java:392)     at org.eclipse.jetty.util.thread.QueuedThreadPool.idleJobPoll(QueuedThreadPool.java:546)     在org.eclipse.jetty.util.thread.QueuedThreadPool.access $ 800(QueuedThreadPool.java:47)     在org.eclipse.jetty.util.thread.QueuedThreadPool $ 3.run(QueuedThreadPool.java:609)     在java.lang.Thread.run(Thread.java:745)

" qtp1143839598-212" #212 prio = 5 os_prio = 0 tid = 0x00007fcd78032000 nid = 0x7354等待条件[0x00007fcd348c7000]    java.lang.Thread.State:TIMED_WAITING(停车)     在sun.misc.Unsafe.park(原生方法)      - 停车等待< 0x00000000850d7fb0> (java.util.concurrent.locks.AbstractQueuedSynchronizer $ ConditionObject)     at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215)     at java.util.concurrent.locks.AbstractQueuedSynchronizer $ ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2078)     在org.eclipse.jetty.util.BlockingArrayQueue.poll(BlockingArrayQueue.java:392)     at org.eclipse.jetty.util.thread.QueuedThreadPool.idleJobPoll(QueuedThreadPool.java:546)     在org.eclipse.jetty.util.thread.QueuedThreadPool.access $ 800(QueuedThreadPool.java:47)     在org.eclipse.jetty.util.thread.QueuedThreadPool $ 3.run(QueuedThreadPool.java:609)     在java.lang.Thread.run(Thread.java:745)

大约有196个线程与上述日志相似

我们期待  任何时间点500K实时连接2.每分钟2000个新连接,4000个重新连接(客户端错误和重试)

有没有办法配置jetty来处理上述要求..以上jstack中的日志显示死锁?或应用程序线程中的问题?或者是否有任何配置要在弹簧腹板中进行以达到上述要求。对不起,如果问题的语言/框架不明确..

0 个答案:

没有答案