springboot 使用undertow代替tomcat容器提高吞吐量

springboot里面默认的容器是tomcat的吞吐量是平均5000

undertow的吞吐量平均是8000

pom.xml文件依赖信息,先解除tomcat依赖,然后再新增undertow依赖。

使用apache-jmeter压力测试工具测试吞吐量

步骤:

1打开jmeter.bat

2新建一个线程组,线程数1,最长时间是10秒,循环次数10000

3线程组下-取样器-http请求

4.http请求-添加-监听器-聚合报告,

5.切到http界面,开始测试,不要在聚合报告页面测试,会影响测试结果。

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>

</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-undertow</artifactId>
</dependency>

</dependencies>

二、使用application.yml文件读取配置文件

springboot项目会读取appication开头的,以properties和yml结尾的文件

需要eclipse安装yml的插件,再help-Eclipse MarketPlace-输入yml搜索安装

user: zhangsan

  name: zhansan

  age: 12

属性冒号后面一个空格,如果下面有子属性,那么子属性前面需要两个空格。

原文地址:https://www.cnblogs.com/wenwenzuiniucha/p/14497260.html