码迷,mamicode.com
首页 > Web开发 > 详细

HttpServer性能比较

时间:2019-06-16 00:25:49      阅读:181      评论:0      收藏:0      [点我收藏+]

标签:net   run   nsf   https   write   ring   信息   uga   git   

在自己的本子上随便测了下几款HttpServer,环境信息就不贴出来了,主要是比对下差距。

测试内容是输出 text/plain 的 hello, world。

先说结论:Netty > JDK HttpServer > Jersey-Netty > Jersey-HttpServer > SpringBoot。

但需要注意下,第一名的Netty吞吐是第二名的HttpServer的2.7倍,而且errors表现也很优秀。

Jersey 的 overhead 也摆在那儿,吞吐瞬间掉到 13156.38 req/sec,可见同步模型的确不擅长撑并发。

排名最后的是 SpringBoot,此前知道它性能差,没想到差成这样。

## Netty
[mougagit@Mous-Air] Desktop$ wrk -t8 -c1000 -d30s http://127.0.0.1:8080/rest/hello
Running 30s test @ http://127.0.0.1:8080/rest/hello
  8 threads and 1000 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    23.03ms   28.61ms 292.67ms   86.37%
    Req/Sec     7.32k     2.27k   21.72k    76.67%
  1743807 requests in 30.10s, 169.63MB read
  Socket errors: connect 0, read 871, write 0, timeout 0
Requests/sec:  57938.49
Transfer/sec:      5.64MB

## JDK HttpServer
[mougagit@Mous-Air] Desktop$ wrk -t8 -c1000 -d30s http://127.0.0.1:8080/hello
Running 30s test @ http://127.0.0.1:8080/hello
  8 threads and 1000 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    17.15ms   25.00ms 570.39ms   98.39%
    Req/Sec     2.69k     1.05k    9.14k    72.41%
  631779 requests in 30.10s, 53.02MB read
  Socket errors: connect 0, read 5491, write 41, timeout 0
Requests/sec:  20990.68
Transfer/sec:      1.76MB

## Jersey-Netty
[mougagit@Mous-Air] Desktop$ wrk -t8 -c1000 -d30s http://127.0.0.1:8080/hello
Running 30s test @ http://127.0.0.1:8080/hello
  8 threads and 1000 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    97.69ms  103.37ms 867.56ms   82.64%
    Req/Sec     1.69k     0.93k   10.89k    84.29%
  396003 requests in 30.10s, 37.77MB read
  Socket errors: connect 0, read 482, write 83, timeout 0
Requests/sec:  13156.38
Transfer/sec:      1.25MB

## Jersey-HttpServer
[mougagit@Mous-Air] Desktop$ wrk -t8 -c1000 -d30s http://127.0.0.1:8080/hello
Running 30s test @ http://127.0.0.1:8080/hello
  8 threads and 1000 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    19.38ms   40.94ms   1.52s    95.95%
    Req/Sec     1.62k     1.35k   11.31k    79.09%
  353962 requests in 30.10s, 38.14MB read
  Socket errors: connect 0, read 17293, write 229, timeout 0
Requests/sec:  11759.31
Transfer/sec:      1.27MB

 

## SpringBoot-tomcat
[mougagit@Mous-Air] Desktop$ wrk -t8 -c1000 -d30s http://127.0.0.1:8080/hello
Running 30s test @ http://127.0.0.1:8080/hello
  8 threads and 1000 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   185.73ms  176.82ms   1.76s    66.01%
    Req/Sec   773.16    496.27     3.62k    76.40%
  188085 requests in 30.08s, 22.62MB read
  Socket errors: connect 0, read 498, write 3, timeout 0
Requests/sec:   6252.72
Transfer/sec:    770.17KB

HttpServer性能比较

标签:net   run   nsf   https   write   ring   信息   uga   git   

原文地址:https://www.cnblogs.com/mougg/p/11029310.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!