首先,我们如果需要修改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. LoadRunner 使用介绍

    功能介绍 安装流程 LoadRunner是一款测试系统行为和性能的负债测试工具,通过模拟上千万用户实施并发复杂以实时性能监控的方式来确认和查找问题.它是一款付费商业软件,开发商为HP,个人开发者可以使 ...

  2. [转]python的requests发送/上传多个文件

    1.需要的环境 Python2.X Requests 库 2.单字段发送单个文件 在requests中发送文件的接口只有一种,那就是使用requests.post的files参数, 请求形式如下:   ...

  3. VCL 中的 Windows API 函数(4): AdjustWindowRectEx

    AdjustWindowRectEx 用在了 Forms.DBCtrls 单元. AdjustWindowRectEx 可以根据窗口样式获取的边缘尺寸. 测试: var   R: TRect; beg ...

  4. java 上传附件的一点积累

    1.第一种: File inFile = new File(downfileA);//downfileA是前台传过来的,文件路径String fileName = inFile.getName();S ...

  5. tornado入门1

    Tornado web server 是使用Python编写出來的一个极轻量级.高可伸缩性和非阻塞IO的Web服务器软件,著名的 Friendfeed 网站就是使用它搭建的. Tornado 跟其他主 ...

  6. Line云端全自动加好友机器人

    一个 LINE 帐号可以加入 5,000 名好友,让这些 5,000 名好友收到 LINE 的主动提醒,好友会看到我的头像.主页照片.姓名与状态消息等,这种行为称为 LINE 的曝光. 如果我们要针对 ...

  7. tooltips插件

    摘要: 继‘带箭头提示框’,本文将分享几款带箭头提示框. qtipqTip是一种先进的提示插件,基于jQuery框架.以用户友好,而且功能丰富,qTip为您提供不一般的功能,如圆角和语音气泡提示,并且 ...

  8. python2内置属性

    # encoding: utf-8 # module __builtin__ # from (built-in) # by generator 1.145 from __future__ import ...

  9. Apache中的Order Allow,Deny用法详解

    本文讲述了Apache中的Order Allow,Deny用法.分享给大家供大家参考,具体如下: Allow和Deny可以用于apache的conf文件或者.htaccess文件中(配合Directo ...

  10. Images.xcassets 的简单使用

    总结起来Images.xcassets 就这么几句话 (1)以下開始简单整理 进入images.xcassets 右键--->New Image Set 或者点XCode的images.xcas ...