农业网站建设方案 ppt,中国有什么网站做跨境零售,深圳市宝安区邮政编码多少,wordpress多城市seoSpringBoot中我们既可以使用Tomcat作为Http服务#xff0c;也可以用Undertow来代替。Undertow在高并发业务场景中#xff0c;性能优于Tomcat。所以#xff0c;如果我们的系统是高并发请求#xff0c;不妨使用一下Undertow#xff0c;你会发现你的系统性能会得到很大的提升…SpringBoot中我们既可以使用Tomcat作为Http服务也可以用Undertow来代替。Undertow在高并发业务场景中性能优于Tomcat。所以如果我们的系统是高并发请求不妨使用一下Undertow你会发现你的系统性能会得到很大的提升。
1、ruoyi-framework\pom.xml模块修改web容器依赖使用undertow来替代tomcat容器 ruoyi-framework中 !-- SpringBoot Web容器 -- dependency groupIdorg.springframework.boot/groupId artifactIdspring-boot-starter-web/artifactId exclusions exclusion artifactIdspring-boot-starter-tomcat/artifactId groupIdorg.springframework.boot/groupId /exclusion /exclusions /dependency !-- web 容器使用 undertow -- ruoyi-admin中添加 dependency groupIdorg.springframework.boot/groupId artifactIdspring-boot-starter-undertow/artifactId /dependency 2、修改application.yml使用undertow来替代tomcat容器 # 开发环境配置
server:# 服务器的HTTP端口默认为80port: 80servlet:# 应用的访问路径context-path: /# undertow 配置undertow:# HTTP post内容的最大大小。当值为-1时默认值为大小是无限的max-http-post-size: -1# 以下的配置会影响buffer,这些buffer会用于服务器连接的IO操作,有点类似netty的池化内存管理# 每块buffer的空间大小,越小的空间被利用越充分buffer-size: 512# 是否分配的直接内存direct-buffers: truethreads:# 设置IO线程数, 它主要执行非阻塞的任务,它们会负责多个连接, 默认设置每个CPU核心一个线程io: 8# 阻塞任务线程池, 当执行类似servlet请求阻塞操作, undertow会从这个线程池中取得线程,它的值设置取决于系统的负载worker: 2563、修改文件上传工具类FileUploadUtils.java private static final File getAbsoluteFile(String uploadDir, String fileName) throws IOException
{File desc new File(uploadDir File.separator fileName);if (!desc.getParentFile().exists()){desc.getParentFile().mkdirs();}// undertow文件上传因底层实现不同,无需创建新文件// if (!desc.exists())// {// desc.createNewFile();// }return desc;
}