springboot框架servlet容器tomcat、Jetty、undertow压测报告

springboot默认servlet框架为tomcat,可通过pom文件配置undertow或jetty容器。

考虑到网络对QPS的影响,tomcat和jetty容器差别不大,undertow在服务器负载、处理时间上优势明显。建议springboot项目使用undertow容器。

压测配置:3台压测机,500并发,0.1秒请求一次,3台受压机,压测时间20分钟。

压测记录:
  容器
  负载(min、max、avg)
 QPS
  处理时间(max、avg)
 io
 gc
 tomcat 
  4.4、6.7、5.5
 3000 ~ 3100
  1100、65
 2000kb
 正常
 undertow
  3.5、5.9、4.5
 3300 ~ 3400
  404、48
 2000kb
 正常
 jetty
  4.5、6.8、5.8
 3000 ~ 3100
  1200、62
 2000kb
 正常

容器配置参数:
     undertow: https://github.com/undertow-io/undertow/blob/master/core/src/main/java/io/undertow/Undertow.java
                # i oThreads = Math.max(Runtime.getRuntime().availableProcessors(), 2)
             server.undertow.io-threads= 8
              #   workerThreads = ioThreads * 8
             server.undertow.worker-threads= 64          
   
jetty:    
             #表示同时在监听read事件的线程数,缺省值为2,对于NIO来说,建议值2*(处理器核数-1);或者小于等于2*处理器核数;
               server.jetty.acceptors= 14
               #Socket selector的数量,默认为-1,Jetty基于处理器核数选择一个值,具体规则是低于4核为1,低于8核为3,8核以上为4
               server.jetty.selectors= 4
pom配置:
     undertow:
        <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>

<!-- Undertow  -->
        <!-- 启动后控制台确认:Undertow start on port(s) 8080 (http)-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-undertow</artifactId>
        </dependency>

     jetty:
        <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>

<!-- jetty -->
        <!-- 启动后控制台确认:Jetty start on port(s) 8080 (http)-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jetty</artifactId>
        </dependency>

jmeter压测记录:
          tomcat:
        

          undertow:


          Jetty:
    
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值