閱讀605 返回首頁    go 阿裏雲 go 技術社區[雲棲]


tomcat報錯INFO: Maximum number of threads (200) created for connector with address null and port 8080

一、發現問題

INFO: Maximum number of threads (200) created for connector with address null and port 8080

說明:最大線程數錯誤
解決方案:使用線程池,用較少的線程處理較多的訪問,可以提高tomcat處理請求的能力。


二、使用方法

打開/conf/server.xml增加

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

最大線程500(一般服務器足夠),最小空閑線程數20,線程最大空閑時間60秒。接著修改<Connector>節點,增加executor屬性。

<Connector executor="tomcatThreadPool"
 port="80" protocol="HTTP/1.1"
 connectionTimeout="60000"
 keepAliveTimeout="15000"
 maxKeepAliveRequests="1"
 redirectPort="443" />


三、linux中查看文件操作數

java.net.SocketException: Too many open files。當tomcat並發用戶量大的時候,單個jvm進程確實可能打開過多的文件句柄。使用lsof -p 10001|wc -l查看文件操作數。

1、ps -ef |grep tomcat
查看tomcat的進程ID,記錄ID號,假設進程ID為10001

2、lsof -p 10001|wc -l
查看當前進程id為10001的文件操作數    

3、ulimit -a
查看每個用戶允許打開的最大文件數默認是1024 

4、ulimit -n 65536
將允許的最大文件數調整為65536


原帖地址:https://blog.csdn.net/ygd266/article/details/8255746

最後更新:2017-04-03 16:48:54

  上一篇:go ubuntu和mac OS X下另一種使用QQ的方法
  下一篇:go 積分牆