98分布式电商项目 - Tomcat性能优化(使用线程池)

简介: 98分布式电商项目 - Tomcat性能优化(使用线程池)

在tomcat中每一个用户请求都是一个线程,所以可以通过开启并使用线程池的方式来提高tomcat的性能。

配置:

参数说明:

Attribute Description
threadPriority (优先级) (int) The thread priority for threads in the executor, the default is 5 (the value of theThread.NORM_PRIORITY constant)
daemon(守护进程) (boolean) Whether the threads should be daemon threads or not, the default is true
namePrefix(名称前缀) (String) The name prefix for each thread created by the executor. The thread name for an individual thread will be namePrefix+threadNumber
maxThreads(最大线程数) (int) The max number of active threads in this pool, default is 200
minSpareThreads(最小活跃线程数) (int) The minimum number of threads always kept alive, default is 25
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 is 60000(1 minute)
maxQueueSize(最大的等待队里数,超过则请求拒绝) (int) The maximum number of runnable tasks that can queue up awaiting execution before we reject them. Default value is Integer.MAX_VALUE
prestartminSpareThreads(是否在启动时就生成minSpareThreads个线程) (boolean) Whether minSpareThreads should be started when starting the Executor or not, the default is false
threadRenewalDelay(重建线程的时间间隔) (long) If aThreadLocalLeakPreventionListener is configured, it will notify this executor about stopped contexts. After a context is stopped, threads in the pool are renewed. To avoid renewing all threads at the same time, this option sets a delay between renewal of any 2 threads. The value is in ms, default value is 1000 ms. If value is negative, threads are not renewed.。重建线程池内的线程时,为了避免线程同时重建,每隔threadRenewalDelay(单位: ms )重建一个线程。默认值为1000 ,设置为负则不重建

修改后如下:

目录
相关文章
|
4月前
|
Java 关系型数据库 MySQL
Windows用Tomcat发布Java项目
对于云服务器,程序员一般不会陌生,如果项目需要发布到现网,那么服务器是必不可缺的一项硬性条件,那么如何在云服务器上部署一个项目,需要做哪些配置准备,下面就由本文档为大家讲解,本篇以Tomcat服务器发布J2EE项目为例。
50 0
Windows用Tomcat发布Java项目
|
3月前
|
JavaScript Java 应用服务中间件
centos部署vue项目(java,tomcat环境的搭建)
centos部署vue项目(java,tomcat环境的搭建)
48 0
|
21天前
|
移动开发 Java 应用服务中间件
tomcat第1章 tomcat介绍、安装、部署项目
tomcat第1章 tomcat介绍、安装、部署项目
|
2月前
|
SpringCloudAlibaba Java 持续交付
【构建一套Spring Cloud项目的大概步骤】&【Springcloud Alibaba微服务分布式架构学习资料】
【构建一套Spring Cloud项目的大概步骤】&【Springcloud Alibaba微服务分布式架构学习资料】
169 0
|
5月前
|
Java 应用服务中间件
SpringBoot 项目war包部署 配置外置tomcat方法
SpringBoot 项目war包部署 配置外置tomcat方法
71 0
|
29天前
|
Java 应用服务中间件
Springboot启动的时候初始化的线程池默认配置tomcat
Springboot启动的时候初始化的线程池默认配置tomcat
15 1
|
3月前
|
Java 应用服务中间件 程序员
互联网大厂为什么禁止SpringBoot项目使用Tomcat?
在SpringBoot框架中,我们使用最多的是Tomcat,这是SpringBoot默认的容器技术,而且是内嵌式的Tomcat。
54 1
互联网大厂为什么禁止SpringBoot项目使用Tomcat?
|
3月前
|
存储 NoSQL 文件存储
C++ 哈希表企业级项目运用---淘宝分布式文件系统
C++ 哈希表企业级项目运用---淘宝分布式文件系统
|
4月前
|
网络协议 Devops 大数据
【分布式】大型互联网项目特点
【1月更文挑战第25天】【分布式】大型互联网项目特点
|
4月前
|
存储 缓存 监控
【分布式】大型互联网项目架构目标
【1月更文挑战第25天】【分布式】大型互联网项目架构目标