【发布时间】:2021-05-28 02:13:54
【问题描述】:
在生产中,我们使用的是 jetty 9.2.9.v20150224,配置如下:
new Server(new QueuedThreadPool(200, 5, 30000, new ArrayBlockingQueue<Runnable>(128)));
maxThreads = 200,minThreads = 5,idleTimout = 30000 毫秒
我测试了我们的应用程序,它能够处理 200 个请求/秒,但很少有客户抱怨有时即使负载非常少,码头也不接受任何新连接,而从日志中我发现 STARTED ,5。据我了解,线程池中有 18 个活动线程,远少于 200 个,但不知何故,新连接仍然被拒绝。以下是从日志中截取的:
2021-01-08 00:20:47,813 WARN [qtp1720926658-14444] QueuedThreadPool : QueuedThreadPool[qtp1720926658]@669341c2{STARTED,5<=18<=200,i=4,q=128}[ReservedThreadExecutor@58a5954d{s=3/4,p=1}] rejected org.eclipse.jetty.io.ManagedSelector$DestroyEndPoint@263c181
2021-01-08 00:20:47,813 WARN [qtp1720926658-14444] QueuedThreadPool : QueuedThreadPool[qtp1720926658]@669341c2{STARTED,5<=18<=200,i=3,q=128}[ReservedThreadExecutor@58a5954d{s=3/4,p=1}] rejected org.eclipse.jetty.io.ManagedSelector$DestroyEndPoint@431081c5
2021-01-08 00:20:47,813 WARN [qtp1720926658-14445] QueuedThreadPool : QueuedThreadPool[qtp1720926658]@669341c2{STARTED,5<=18<=200,i=2,q=128}[ReservedThreadExecutor@58a5954d{s=3/4,p=1}] rejected org.eclipse.jetty.io.ManagedSelector$DestroyEndPoint@3866d8cd
2021-01-08 00:20:47,813 WARN [qtp1720926658-14442] QueuedThreadPool : QueuedThreadPool[qtp1720926658]@669341c2{STARTED,5<=18<=200,i=6,q=126}[ReservedThreadExecutor@58a5954d{s=1/4,p=2}] rejected CEP:SocketChannelEndPoint@4aa81d65{/10.0.1.29:53143<->/10.0.1.28:7777,OPEN,fill=FI,flush=-,to=16442/30000}{io=1/0,kio=1,kro=1}->HttpConnection@32cdb0b1[p=HttpParser{s=START,0 of -1},g=HttpGenerator@22c521c0{s=START}]=>HttpChannelOverHttp@e02e50f{r=1,c=false,a=IDLE,uri=null,age=0}:runFillable:BLOCKING
2021-01-08 00:20:47,829 WARN [qtp1720926658-14442] EatWhatYouKill :
java.util.concurrent.RejectedExecutionException: CEP:SocketChannelEndPoint@4aa81d65{/10.0.1.29:53143<->/10.0.1.28:7777,OPEN,fill=FI,flush=-,to=16442/30000}{io=1/0,kio=1,kro=1}->HttpConnection@32cdb0b1[p=HttpParser{s=START,0 of -1},g=HttpGenerator@22c521c0{s=START}]=>HttpChannelOverHttp@e02e50f{r=1,c=false,a=IDLE,uri=null,age=0}:runFillable:BLOCKING
at org.eclipse.jetty.util.thread.QueuedThreadPool.execute(QueuedThreadPool.java:440)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.execute(EatWhatYouKill.java:370)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:305)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:168)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:126)
at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:366)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:762)
at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:680)
at java.lang.Thread.run(Thread.java:748)
【问题讨论】:
-
升级 Jetty,9.2.9 现已弃用/EOL(生命终止) - eclipse.org/jetty/download.php#what-jetty-version - 自 9.2.9 发布以来的过去 6 年中,线程执行逻辑发生了巨大变化。跨度>