没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
1. 目的
通过优化 提高网站的并发能力。
2. 服务器资源
服务器所能提供 、内存、硬盘的性能对处理能力有决定性影响。
3. 优化配置
3.1. 配置 tomcat 管理员账户
在 下添加用户:
启动 ,登录查看信息:
!"#$%%"!&%&%
3.2. tomcat 的 3 种运行模式
的运行模式有 ' 种:
"、 (
默认的模式性能非常低下没有经过任何优化处理和支持
#、
)*+,,是 -./0"1 及后续版本提供的一种新的 *+ 操作方式)即 2. 包及其
子包,。-. 是一个基于缓冲区、并能提供非阻塞 *+ 操作的 -.3*,因此 也被
看成是 (4*+ 的缩写。它拥有比传统 *+ 操作)(,更好的并发运行性能。
'、
安装起来最困难但是从操作系统级别来解决异步的 *+ 问题大幅度的提高性能
3.2.1. 启动 NIO 模式
修 改 . 里 的 节 点 修 改 为
org.apache.coyote.http11.Http11NioProtocol
<Connector port="8080" protocol="org.apache.coyote.http11.Http11NioProtocol"
executor="tomcatThreadPool" connectionTimeout="20000" redirectPort="8443"
URIEncoding="UTF-8"/>
3.3. 执行器(线程池)
在 中每一个用户请求都是一个线程,所以可以使用线程池提高性能。
3.3.1. 开启并且使用
配置:.
3.3.2. 参数说明
Attribute Description
threadPriority ( 优 先
级)
(int) The thread priority for threads in the
executor, the default is5(the value of
theThread.NORM_PRIORITYconstant)
daemon(守护进程)
(boolean) Whether the threads should be
daemon threads or not, the default istrue
namePrex ( 名 称 前
缀)
(String) The name prex for each thread
created by the executor. The thread name
for an individual thread will
benamePrex+threadNumber
maxThreads ( 最 大 线
程数)
(int) The max number of active threads in
this pool, default is200
minSpareThreads ( 最
小活跃线程数)
(int) The minimum number of threads
always kept alive, default is25
maxIdleTime ( 空 闲 线
程等待时间)
(int) The number of milliseconds before an
idle thread shutsdown, unless the number
of active threads are less or equal to
minSpareThreads. Default value is60000(1
minute)
maxQueueSize ( 最 大
的等待队里数,超过则请
求拒绝)
(int) The maximum number of runnable
tasks that can queue up awaiting execution
before we reject them. Default value
isInteger.MAX_VALUE
prestartminSpareThre
ads
(boolean) Whether minSpareThreads
should be started when starting the
Executor or not, the default isfalse
剩余44页未读,继续阅读
资源评论
豁然开朗No1
- 粉丝: 28
- 资源: 20
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功