我的 Jetty 应用程序服务器有问题。从昨天开始,我们有一个大问题。有时,Jetty 似乎只是挂起并且不想进行任何 RPC 调用。如果我重新启动它,它会恢复到正常状态,但问题会在几个小时后再次出现。
我注意到当我们遇到问题时,Nginx 的日志会提示这个错误:
2012/05/17 17:00:47 [error] 14728#0: *506735 upstream timed out (110: Connection timed out) while reading response header from upstream, client: xx.xxx.xxx.xx, server: www.MY-SERVER.com, request: "POST /com.xxxx.xxxx.XXXX/Service HTTP/1.1", upstream: "http://127.0.0.1:8080/com.xxxx.xxxx.XXXX/Service", host: "www.MY-SERVER.com", referrer: "https://www.MY-SERVER.com/"
即使运行良好,Nginx 也会提示此警告:
2012/05/17 17:04:44 [warn] 14728#0: *506906 a client request body is buffered to a temporary file /var/cache/nginx/client_temp/0000088415,
客户端:xx.xxx.xxx.xx,服务器:www.MY-SERVER.com,请求:“POST /report HTTP/1.1”,主机:“www.MY-SERVER.com” 是不是很吓人?
我听说当 Jetty 像这样挂起时,可能是因为线程问题。我该如何验证呢?这是我的服务器线程池配置,可能有助于诊断问题。
<!-- =========================================================== -->
<!-- Server Thread Pool -->
<!-- =========================================================== -->
<Set name="ThreadPool">
<!-- Default queued blocking threadpool -->
<New class="org.eclipse.jetty.util.thread.QueuedThreadPool">
<Set name="minThreads">10</Set>
<Set name="maxThreads">200</Set>
<Set name="detailedDump">false</Set>
</New>
</Set>
<!-- =========================================================== -->
<!-- Set connectors -->
<!-- =========================================================== -->
<Call name="addConnector">
<Arg>
<New class="org.eclipse.jetty.server.nio.SelectChannelConnector">
<Set name="host"><Property name="jetty.host" /></Set>
<Set name="port"><Property name="jetty.port" default="8080"/></Set>
<Set name="maxIdleTime">300000</Set>
<Set name="Acceptors">2</Set>
<Set name="statsOn">false</Set>
<Set name="confidentialPort">8443</Set>
<Set name="lowResourcesConnections">20000</Set>
<Set name="lowResourcesMaxIdleTime">5000</Set>
</New>
</Arg>
</Call>