2013-08-22 32 views

回答

16

這取決於你所使用接受請求的類型連接器上。在server.xml中有一個名爲maxConnections的參數,可以將其配置爲限制傳入請求的數量。這裏是description of maxConnections params for Tomcat 7

服務器將接受在任何給定的時間 進程的最大連接數。達到此數量後, 服務器將不會再接受任何連接,直到 連接數低於此值爲止。操作系統仍然可以根據acceptCount設置接受連接。默認值 因連接器類型而異。爲BIO默認是 maxThreads的值,除非一個執行器在這種情況下,默認將 是從執行程序maxThreads的值使用。對於NIO的默認值是10000 爲APR /本地,默認爲8192

注意,對於APR /原生Windows上,配置的值將 減少到1024最高倍數小於或等於到 maxConnections。這是出於性能原因而完成的。如果設置爲-1 值時,MAXCONNECTIONS功能被禁用和連接 不計

+0

maxConnections定義最大連接數服務器不接受同時處理的最大數量的請求 – Prateek

+3

@Prateek不,它不。 Juned引用了這裏的Tomcat文檔。你所指的是'acceptCount'和listen backlog隊列的組合。 – EJP

+0

@EJP但在我的答案中提到的tomcat文檔頁面指定maxThreads.please幫助我弄清楚如果我錯了...... :) – Prateek

0

Tomcat的連接器可以被配置爲只服務同時請求一定數量的 - 這是配置的server.xml中

MaxConnections屬性
0

this forum和快速完整性檢查:

Tomcat具有最大數量的併發線程,用於處理請求;這可以在conf/server.xml配置[爲maxConnections和相關選項],並默認設置爲50

+1

Tomcat不具有在默認情況下,連接器指定maxThreads服務器。xml配置。根據文檔,maxThreads未指定時的默認值爲200. https://tomcat.apache.org/tomcat-7.0-doc/config/http.html#Standard_Implementation也適用於Tomcat 6 – JanM

10

server.xml文件指定maxThreadsspecifies maximum number of simultaneous requests that can be handled..

<Connector port="8080" maxThreads="150" minSpareThreads="25" maxSpareThreads="75" 
       enableLookups="false" redirectPort="4443" acceptCount="100" 
       debug="0" connectionTimeout="60000" 
       disableUploadTimeout="true" /> 

在Tomcat中7,

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.

編輯:如果執行與該連接器相關的,這個屬性被忽略,因爲連接器將使用執行而不是內部的線程池執行任務。

欲瞭解更多信息,請參閱此鏈接Tomcat 7 Doc

+0

如果定義了執行程序,則省略了有關被忽略的屬性的最後一個句子。 – EJP

+0

更新了我的答案,這意味着maxThread值在maxConnections中使用。 – Prateek

+0

Tomcat可以處理的請求的上限是多少? –

相關問題