溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

如何修改Tomcat最大連接數

發布時間:2021-07-13 10:58:20 來源:億速云 閱讀:451 作者:Leah 欄目:大數據

如何修改Tomcat最大連接數,針對這個問題,這篇文章詳細介紹了相對應的分析和解答,希望可以幫助更多想解決這個問題的小伙伴找到更簡單易行的方法。

首先,打開tomcat官網首頁:http://tomcat.apache.org/ ;
然后,我們點擊左側導航欄中“Documentation”下的Tomcat對應版本,進入tomcat文檔首頁;
再然后,在左側導航欄中找到Reference下的Configuration,點進去;
最后,在左側導航欄中找到Connectors中的HTTP/1.1。

http://tomcat.apache.org/
http://tomcat.apache.org/tomcat-8.5-doc/index.html
http://tomcat.apache.org/tomcat-8.5-doc/config/http.html

其中這句話已經介紹得很清楚:

If more simultaneous requests are received than can be handled by the currently available request processing threads, additional threads will be created up to the configured maximum (the value of the maxThreads attribute). If still more simultaneous requests are received, they are stacked up inside the server socket created by the Connector, up to the configured maximum (the value of the acceptCount attribute).

所以我們需要設置的是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:

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

關于如何修改Tomcat最大連接數問題的解答就分享到這里了,希望以上內容可以對大家有一定的幫助,如果你還有很多疑惑沒有解開,可以關注億速云行業資訊頻道了解更多相關知識。

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

亚洲午夜精品一区二区_中文无码日韩欧免_久久香蕉精品视频_欧美主播一区二区三区美女