日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

简单介绍tomcat中maxThreads,acceptCount,connectionTimeout

發布時間:2025/4/16 编程问答 34 豆豆
生活随笔 收集整理的這篇文章主要介紹了 简单介绍tomcat中maxThreads,acceptCount,connectionTimeout 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
<?xml version='1.0' encoding='utf-8'?> <Server port="8005" shutdown="SHUTDOWN"><Listener className="org.apache.catalina.startup.VersionLoggerListener" /><Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" /><!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html --><Listener className="org.apache.catalina.core.JasperListener" /><!-- Prevent memory leaks due to use of particular java/javax APIs--><Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" /><Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" /><Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" /><GlobalNamingResources><Resource name="UserDatabase" auth="Container"type="org.apache.catalina.UserDatabase"description="User database that can be updated and saved"factory="org.apache.catalina.users.MemoryUserDatabaseFactory"pathname="conf/tomcat-users.xml" /></GlobalNamingResources><Service name="Catalina"><!--<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />--><!-- Define an AJP 1.3 Connector on port 8080 --><!-- maxThreads 請求處理線程的最大數量。默認值是200(Tomcat7和8都是的)。如果該Connector綁定了Executor,這個值會被忽略,因為該Connector將使用綁定的Executor,而不是內置的線程池來執行任務--><!-- acceptCount accept隊列的長度;當accept隊列中連接的個數達到acceptCount時,隊列滿,進來的請求一律被拒絕。默認值是100--><!-- connectionTimeout Tomcat在任意時刻接收和處理的最大連接數。當Tomcat接收的連接數達到maxConnections時,Acceptor線程不會讀取accept隊列中的連接;這時accept隊列中的線程會一直阻塞著,直到Tomcat接收的連接數小于maxConnections。如果設置為-1,則連接數不受限制。--><Connector port="8009" protocol="AJP/1.3" redirectPort="8443" maxThreads="600" minSpareThreads="100" maxSpareThreads="500" acceptCount="700" connectionTimeout="20000"/><Engine name="Catalina" defaultHost="localhost"><Realm className="org.apache.catalina.realm.LockOutRealm"><Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/></Realm><Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true"><Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"prefix="localhost_access_log." suffix=".txt"pattern="%h %l %u %t "%r" %s %b" /></Host></Engine></Service> </Server>

  

?

http://tomcat.apache.org/?我們點擊左側導航欄中“Documentation”下的Tomcat 7.0,進入到這個鏈接中:http://tomcat.apache.org/tomcat-7.0-doc/index.html?,詳細的信息我們不用都看,在左側導航欄中有一個鏈接Configuration,我們點進去之后,再點擊其左側導航欄中connector一項的HTTP,就進入到HTTP連接數及其他相關屬性的設置頁面了。在這里(http://tomcat.apache.org/tomcat-7.0-doc/config/http.html)我們可以看到,在Connector的屬性配置中,壓根就沒有maxProcessors等的設置選項。其中這句話已經介紹得很清楚:

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.

轉載于:https://www.cnblogs.com/qianjinyan/p/9257149.html

總結

以上是生活随笔為你收集整理的简单介绍tomcat中maxThreads,acceptCount,connectionTimeout的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。