参考https://examples.javacodegeeks.com/enterprise-java/spring/tomcat-vs-jetty-vs-undertow-comparison-of-spring-boot-embedded-servlet-containers/做了一个性能测试,用于web服务器选型。
使用jmeter简单测试了一下,结论先行:性能:undertow>tomcat>jetty
调用同样的接口,分别对三种web服务器做测试
<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>--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-jetty</artifactId> </dependency> </dependencies>
1. spring-web默认使用tomcat时,吞吐率如下:
2. spring-web使用undertow时,吞吐率如下:
3. spring-web使用jetty时,吞吐率如下: