tomcat中的server.xml

tomcat_home_directory/conf/server.xml中:
		

	配置:
	<!-- 自定义一个线程池:name -->
	<!-- 属性:				 -->
	<!-- 	name:线程池的名称 -->
	<!-- 	namePrefix:线程池中线程名的前缀,默认为catalina-exec-(注:tomcat线程池中线程的名称为:前缀+线程number) -->
	<!-- 	maxThreads:线程池中允许创建的最大线程数,默认是200 -->
	<!-- 	minSpareThreads:线程池中保持的最小线程数(即线程池中的corePoolSize),默认是10。 -->
	<!-- 	maxIdleTime:空闲线程被关闭的超时时间,默认是60000毫秒,即1分钟。(注:只有当前活跃的线程数大于minSpareThreads时,tomcat才会去关闭空闲的线程) -->
	<!-- 	maxQueueSize:线程池中任务队列的容量,默认为Integer.MAX_VALUE -->
	<!-- 	prestartminSpareThreads:是否在启动时就生成minSpareThreads个线程,默认是false -->
    <Executor name="tomcatThreadPool" 
		namePrefix="catalina-exec-"
                maxThreads="1000"
		minSpareThreads="100"
		maxIdleTime=300000
		maxQueueSize="100000"
		prestartminSpareThreads="false"
		/>
	
    <!-- 配置Connector -->
	<!-- 属性:				 -->
	<!-- 	executor:指定使用的线程池。 -->
	<!-- 	注意:1>如果不配置线程池,则tomcat会使用一个默认的连接池。 -->
	<!-- 		  2>如果指定了Connector的executor,则Connector其它的线程相关的属性将被忽略。 -->
	<!-- 	URIEncoding:编码格式,tomcat8默认使用utf-8,tomcat7默认使用ISO-8859-1。 -->
	<!-- 	maxConnections:tomcat可以同时处理的最大请求数(即有多少个socket可以同时连接到tomcat上),即tomcat的最大并发数。对于NIO的默认值是10000,对于APR/native的默认值是8192。 -->
	<!-- 	acceptCount:请求队列的容量,默认值是100。注意区分这里的请求等待队列和线程池中的任务等待队列。 	-->
	<!--		说明: 																						-->
	<!--			1>当处理请求的线程数达到最大(即处理请求的线程数为maxThreads) 或 请求的数量达到maxConnections时,如果还有请求进来,则将请求放到一个容量为acceptCount的等待队列中,若等待队列已满,则tomcat会拒绝掉新的请求。 	-->
	<!--			2>(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.)	-->
	<!-- 	acceptorThreadCount:用于接收连接请求的线程的数量,默认为1。(The number of threads to be used to accept connections. Increase this value on a multi CPU machine) -->
	<!-- 	enableLookups:Set to true if you want calls to request.getRemoteHost() to perform DNS lookups in order to return the actual host name of the remote client. Set to false to skip the DNS lookup and return the IP address in String form instead (thereby improving performance). By default, DNS lookups are disabled -->
	<!-- 	disableUploadTimeout:是否禁用数据上传超时限制,默认为true -->
	<!-- 	connectionUploadTimeout:上传数据的超时时间,单位是毫秒,只有当disableUploadTimeout为false时才有效。 -->

    <Connector executor="tomcatThreadPool"
               port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443"
			   URIEncoding="utf-8"
			   acceptorThreadCount="2"
			   enableLookups="false"
			   disableUploadTimeout="true"
			   acceptCount="1000"/>
			   
			   
			   

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值