首先,我们如果需要修改tomcat 7的最大连接数,我们可以去tomcat官方网站,查看Documentation

进入tomcat的官方网站http://tomcat.apache.org我们点击左侧导航栏中"Documentation"下的Tomcat 7.0

进入到这个链接后,详细的信息我们不用都看,注意在左侧导航栏Reference下有一个链接Configuration菜单选择项

我们点进去之后,再点击其左侧导航栏中connector一项的HTTP,就进入到HTTP连接数及其他相关属性的设置页面了。在这里

http://tomcat.apache.org/tomcat-7.0-doc/config/http.html我们可以看到,在Connector的属性配置中,网上有很多文章说可以修改maxProcessors等参数

但这里的官方文档上压根就没有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 configuredmaximum (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).

所以我们需要设置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 . 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 .

所以两者的默认值分别是200和100,要调整Tomcat的默认最大连接数,可以增加这两个属性的值,并且使acceptCount大于等于maxThreads

对于tomcat是修改./server.xml文件,对于virgo-tomcat则是修改./configuration/tomcat-server.xml文件,配置的格式都大同小异的,这里以virgo-tomcat为例

<Service name="Catalina">
<Connector port="" protocol="HTTP/1.1"
connectionTimeout=""
redirectPort="" maxThreads="" acceptCount=""
URIEncoding="UTF-8" compression="on" compressionMinSize=""
noCompressionUserAgents="gozilla, traviata" compressableMimeType="text/html,text/xml" />

其中上述配置的意义如下:

maxThreads="400"    即最大线程数,表示最多同时处理400个连接 ,默认为200

acceptCount="500"    最大排队数,当同时连接的数量达到maxThreads时,还可以接收排队的连接,超过这个连接的则直接返回拒绝连接。

简单的说,对于maxThreads,acceptCount有如下三种情况

情况1:接受一个请求,此时tomcat起动的线程数没有到达maxThreads,tomcat会起动一个线程来处理此请求。

情况2:接受一个请求,此时tomcat起动的线程数已经到达maxThreads,tomcat会把此请求放入等待队列,等待空闲线程。

情况3:接受一个请求,此时tomcat起动的线程数已经到达maxThreads,等待队列中的请求个数也达到了acceptCount,此时tomcat会直接拒绝此次请求,返回connection refused

尊重别人的劳动成果 转载请务必注明出处:http://www.cnblogs.com/5201351/p/4499169.html

virgo-tomcat-server最大并发连接数的修改的更多相关文章

  1. Virgo Tomcat Server 指南-Hello World

    Eclipse发布了最新的Virgo Tomccat Server.VTS是一个应用服务器与OSGi紧密结合并且可以开发bundles形式的Spring web apps应用,他们同样拥有OSGi和S ...

  2. tomcat server location 地址的修改

    如果是目录是灰色,那么请先删除现有的项目,然后Clean 修改之后,发布的目录是.具体目录与tomcat 安装目录相关 access_log

  3. JDK和Tomcat环境变量,以及用MyEclipse新建Web Project测试Tomcat Server

    [请尊重原创版权,如需引用,请注明来源及地址] 在此之前一直用的Eclipse挺顺手的,今天突然想换MyEclipse试试,不知安装MyEclipse的时候我选错了什么选项,反正JDK和Tomcat的 ...

  4. tomcat server需要重启的时刻

    1.修改了web project的任何配置文件,都需要重启tomcat 2.修改了任何java class文件,都需要重启tomcat server 3.在项目中添加了任何的文件,包括配置文件.jav ...

  5. Tomcat Server Configuration Automation Reinforcement

    目录 . 引言 . 黑客针对WEB Server会有那些攻击面 . 针对Tomcat Server可以做的安全加固 . Managing Security Realms with JMX . 实现对T ...

  6. tomcat相关配置技巧梳理 (修改站点目录、多项目部署、限制ip访问、大文件上传超时等)

    tomcat常用架构:1)nginx+tomcat:即前端放一台nginx,然后通过nginx反向代理到tomcat端口(可参考:分享一例测试环境下nginx+tomcat的视频业务部署记录)2)to ...

  7. eclipse新建tomcat server但是总是报404的解决方法

    今天在eclipse中新建了tomcat server,但是由于一些配置出了问题,导致总是出现404报错,具体情况如下 症状: tomcat在eclipse里面能正常启动,而在浏览器中访问http:/ ...

  8. Apache Tomcat Server Options 选项说明

    Apache Tomcat Server Options 选项说明 p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px 'Helvetica Neu ...

  9. java:安装Runtime Environment,设置Tomcat Server 的方法

    Eclipse 中开发Webapp, 一般需要配置Tomcat Server, 以便在Eclipse 中进行Debug.具体的步骤如下: 1. Windows ==>Preference ==& ...

  10. tomcat——Server.xml

    本机tomcat位置:D:\tomcat7\apache-tomcat-7.0.61 server.xml 位置:D:\tomcat7\apache-tomcat-7.0.61\conf 注意:ser ...

随机推荐

  1. SharePoint 2013 页面中window/document.onload/ready 事件不能触发的解决方案

    问题1:在SharePoint 2013页面中使用Javascript 事件window/document.onload/ready时,你会发现处理onload/ready事件的代码根本不能执行. 问 ...

  2. [转]java的(PO,VO,TO,BO,DAO,POJO)类名包名解释

    java的(PO,VO,TO,BO,DAO,POJO)类名包名解释 2015-04-28 20:11 by Loull, 18 阅读, 0 评论, 收藏, 编辑 VO:值对象.视图对象 PO:持久对象 ...

  3. 【ES】简单使用

    import sys reload(sys) sys.setdefaultencoding('utf-8') from datetime import datetime from elasticsea ...

  4. jsch下载文件的两个注意点

    1.关于sftp文件上传和下载的网上很多code,此处就不多写了.主要记录下工作中遇到的两个问题需要多注意. 1.判断sftp远程文件是否存在,通过异常捕获来判断该文件是否存在,存在返回SftpATT ...

  5. Python+Django(Python Web项目初体验)

    参考:https://blog.csdn.net/qq_34081993/article/details/79229784 Django是一个开放源代码的Web应用框架,由Python写成. 安装Dj ...

  6. 使用a标签制作tooltips

    摘要: 前面已经分享了三种方法制作tooltips,今天再来分享一个借助a标签来实现tooltips的方法. 效果如下:

  7. win7+ oracle +php环境的搭建

    http://blog.csdn.net/chchmlml/article/details/6887326 先下载个wmpp1.7.5(之前在xp上也是这个,所以就继续),安装,一切顺利,打开phpi ...

  8. C 复制字符串

    不是C++的string, 而是C的字符串复制,  以前一直使用strcpy(), 其实也可以使用sprintf(destbuf, "%s", srcbuf);  偶有所得,  其 ...

  9. passport登录问题:passport.use 方法没有被调用

    写passport登录验证时,无论如何passport.use 方法都没有被调用,最后在同事的帮助下,才找到问题: 我是用form提交登陆数据的, input type:"text" ...

  10. Resolve PSExec "Access is denied"

    PSExec拒绝访问的解决办法 Just modify Windows Registry, and reboot. psexec_fix.reg: Windows Registry Editor Ve ...