<?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.

简单介绍tomcat中maxThreads,acceptCount,connectionTimeout的更多相关文章

  1. 简单介绍Tomcat

    Tomcat是一个Web容器,或者说是Web服务器.用于管理和部署Web应用.还有一种服务器叫做应用服务器,它的功能比web服务器要强大的多,因为它可以部署EJB应用,可以实现容器管理的事务,一般的应 ...

  2. 转载:简单介绍Python中的try和finally和with方法

    用 Python 做一件很平常的事情: 打开文件, 逐行读入, 最后关掉文件; 进一步的需求是, 这也许是程序中一个可选的功能, 如果有任何问题, 比如文件无法打开, 或是读取出错, 那么在函数内需要 ...

  3. 简单介绍 Java 中的注解 (Annotation)

    1. 例子 首先来看一个例子: @Override public String toString() { return "xxxxx"; } 这里用了 @Override, 目的是 ...

  4. 简单查看tomcat中部署java服务的内存使用情况

    vim tomcat_mem.sh NAME=$1 #部署项目名称 #PID=`ps -ef|grep tomcat|grep $NAME|awk '{print $2}'` PID=`ps -ef| ...

  5. java中String、StringBuffer和StringBuilder的区别(简单介绍)

    简单介绍 java中用于处理字符串常用的有三个类: 1.java.lang.String 2.java.lang.StringBuffer 3.java.lang.StrungBuilder 三者共同 ...

  6. Java网络编程与NIO详解11:Tomcat中的Connector源码分析(NIO)

    本文转载 https://www.javadoop.com 本系列文章将整理到我在GitHub上的<Java面试指南>仓库,更多精彩内容请到我的仓库里查看 https://github.c ...

  7. java随机数Reandom(简单介绍)

    简单介绍 Java中存在着两种Random函数 一.java.lang.Math.Random; 调用这个Math.Random()函数能够返回带正号的double值,该值大于等于0.0且小于1.0, ...

  8. Java集合简单介绍

    再最前面分享一下我再学习集合时的方法: 1.首先了解各集合的定义和特点 2.集合的构造方法和常用方法(增删改查等) 3.了解集合使用的场景,再什么情况下使用什么类型的集合(关键是集合的特性) 4.了解 ...

  9. Tomcat中acceptCount,maxConnections、maxThreads的含义及关系

    个人对tomcat连接器3个属性maxConnections.maxThreads.acceptCount的理解: 先摘取官网对这3个属性的描述: acceptCount The maximum qu ...

随机推荐

  1. [LeetCode] 122. Best Time to Buy and Sell Stock II_Easy tag: Dynamic Programming

    Say you have an array for which the ith element is the price of a given stock on day i. Design an al ...

  2. testng入门教程11 TestNG运行JUnit测试

    现在,您已经了解了TestNG和它的各种测试,如果现在担心如何重构现有的JUnit代码,那就没有必要,使用TestNG提供了一种方法,从JUnit和TestNG按照自己的节奏.也可以使用TestNG执 ...

  3. VMware11 安装MAC OS X 10.9

    由于本人使用的是window电脑,想开发苹果,选择了安装VMware10 安装MAC OS X 10.9 来实现. 链接:http://jingyan.baidu.com/article/84b4f5 ...

  4. 形象易懂讲解算法I——小波变换

    https://zhuanlan.zhihu.com/p/22450818?refer=dong5 最早发于回答:能不能通俗的讲解下傅立叶分析和小波分析之间的关系? - 咚懂咚懂咚的回答现收入专栏. ...

  5. 结合ajax 的表单验证

    浪费了我两天的时间 我也是醉了 html  结构 <!-- 密码修改 --> <div class="modal fade" id="operatePa ...

  6. Hive 常用函数汇总

    Hive内部提供了很多函数给开发者使用,包括数学函数,类型转换函数,条件函数,字符函数,聚合函数,表生成函数等等,这些函数都统称为内置函数. 目录 数学函数 集合函数 类型转换函数 日期函数 条件函数 ...

  7. addEventListener的click和onclick的区别

    前两节都和addEventListener的click有关,于是在想它与onclick有什么区别呢,自己调试了一下,网上也有相关资料 事件绑定 onclick绑定方式 优点: - 简洁 - 处理事件的 ...

  8. JS四舍五入保留两位小数

    //四舍五入保留2位小数(若第二位小数为0,则保留一位小数) function keepTwoDecimal(num) { var result = parseFloat(num); if (isNa ...

  9. Tomcat的work目录作用

    Tomcat的work目录作用 很多网友喜欢把tomcat的work目录里的东西叫做缓存,其实那不是很恰当,work目录只是tomcat的工作目录,也就是tomcat把jsp转换为class文件的工作 ...

  10. JavaScript 添加新元素

    JavaScript 添加新元素 版权声明:未经授权,严禁转载! 添加元素 创建元素 使用 JS 可以为一个已有的元素添加一个新的子元素. 第一步:创建空元素. - var elem = docume ...