設置 TOMCAT 請求超時時間 和 最大連接數


轉載 :https://blog.csdn.net/liufuwu1/article/details/54890834

可以通過設置tomcat下conf文件夾的server.xml文件,對請求連接數和請求超時時間進行設置。

 

  1.  
    <Connector port="8080" protocol="HTTP/1.1"
  2.  
    connectionTimeout="20000"
  3.  
    redirectPort="8443" acceptCount="500" maxThreads="400" />

connectionTimeout以毫秒為單位,默認設置為20秒。通過修改該參數,可以修改tomcat的請求超時時間;

 

關於修改最大並發請求連接數,需要修改maxThreads和acceptCount兩個參數,

 

其中,maxThreads的介紹如下:(最大並發請求數)

The maximum number of request processing threads to be created by this Connector, which therefore determines the maximum number of simultaneous requests that can be handled. If not specified, this attribute is set to 200. If an executor is associated with this connector, this attribute is ignored as the connector will execute tasks using the executor rather than an internal thread pool.

而acceptCount的介紹為:(傳入連接請求的最大隊列長度)

The maximum queue length for incoming connection requests when all possible request processing threads are in use. Any requests received when the queue is full will be refused. The default value is 100.

所以兩者的默認值分別是200和100,要調整Tomcat的默認最大連接數,可以增加這兩個屬性的值,並且使acceptCount大於等於maxThreads

 

本文轉載自linux社區,作者:qysh123,文章鏈接:http://www.linuxidc.com/Linux/2013-09/90332.htm


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM