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

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

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

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

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

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

代码 https://github.com/MouGG/http-server-performance/

## 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

# Jooby

[mougagit@Mous-Air] jersey-demo$ wrk -t8 -c1000 -d30s http://127.0.0.1:8080/
Running 30s test @ http://127.0.0.1:8080/
  8 threads and 1000 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency     8.40ms   21.04ms 410.37ms   94.14%
    Req/Sec     4.89k     2.35k   16.23k    68.60%
  1158820 requests in 30.09s, 125.99MB read
  Socket errors: connect 755, read 114, write 9, timeout 0
Requests/sec:  38509.50
Transfer/sec:      4.19MB

## 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

## RESTeasy-netty4

[mougagit@Mous-Air] ~$ 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    22.35ms    8.76ms 243.74ms   76.08%
    Req/Sec     1.80k     1.46k    6.14k    66.70%
  322916 requests in 30.10s, 40.65MB read
  Socket errors: connect 755, read 165, write 37, timeout 0
Requests/sec:  10727.35
Transfer/sec:      1.35MB

## 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

最新文章

  1. EF jsonignore
  2. Linux(Centos)之安装tomcat并且部署Java Web项目
  3. 代理模式及jdk动态代理原理
  4. <java基础学习>02JAVA的基础组成
  5. datatables 前端表格插件 增删改查功能
  6. WinServer2008 R2搭建TFS2013小结(无法连接Internet手动安装)
  7. Mysql存储过程总结
  8. 229. Majority Element II -- 找出数组中出现次数超过 ⌊ n/3 ⌋ 次的数
  9. shell流程控制语句
  10. CFLAGS,CPPFLAGS,CXXFLAGS in Makefile
  11. java实现版本号的比较
  12. emacs使用指南
  13. TextBox控件只允许输入出生日期,并验证年龄不得小于18岁
  14. [转]CENTOS 6.5 配置YUM安装NGINX+服务器负载均衡
  15. Bootstrap 输入组
  16. WOW.js轻松为网页添加动画切入效果
  17. hdu 5439(找规律)
  18. Can not find the tag library descriptor for "http://java.sun.com/jsp/jst1/core
  19. 405 css样式的研究 list-style-type 属性研究
  20. 006_饿了么大前端总监sofish帮你理清前端工程师及大前端团队的成长问题!

热门文章

  1. 我的第一个Maven Helloworld
  2. eclipse unable to start within 45 seconds
  3. LVS笔试题!
  4. jarvis OJ部分writeup
  5. vue学习指南:第十五篇(详细) - Vuex
  6. linux切换普通用户遇bash-4.1解决
  7. 如何把U盘的两个盘或者多个盘合成一个
  8. python多线程返回值的实现与处理
  9. Python之路Day02
  10. t-SNE