在自己的本子上随便测了下几款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

HttpServer性能比较的更多相关文章

  1. HttpServer带阻塞性能比较

    服务端在返回hello,world! 之前先阻塞一秒钟,模拟访问DB等耗时操作. Netty 我直接在 WorkerGroup 里头sleep,用同步阻塞线程模型的方式来编程,所以性能暴降. Joob ...

  2. 提升 web 应用程序的性能(二)

    最佳实践 本章将略述能帮助您提升 web 应用程序性能的最佳实践. 减少 HTTP 请求数 每个 HTTP 请求都有开销,包括查找 DNS.创建连接及等待响应,因此削减不必要的请求数可减少不必要的开销 ...

  3. PHP使用libevent实现高性能httpServer

    今天发现php也有一个libevent的扩展,安装后尝试下了一个webserver(httpserver), 发现性能还不错,逻辑很简单,每秒响应速度1800~4000次/s 代码如下 <?ph ...

  4. Flask, Tornado, GEvent, 以及它们的结合的性能比较

    Flask, Tornado, GEvent, 以及它们的结合的性能比较 英文: http://blog.wensheng.com/2011/10/performance-of-flask-torna ...

  5. vertx的HttpServer模块

    Start HttpServer /** * 启动 HttpServer * multi instances 采用 synchronized防止线程安全问题 * addHandlers 方法是acto ...

  6. Flask性能优化对比

    基于Flask的网关:Flask,Uwsgi,Gevent,Gunicorn(gevent),Tornado,Twisted !/usr/bin/python -- coding:utf-8 -- 美 ...

  7. Netty和Tomcat的区别、性能对比

    一.Netty和Tomcat有什么区别? Netty和Tomcat最大的区别就在于通信协议,Tomcat是基于Http协议的,他的实质是一个基于http协议的web容器,但是Netty不一样,他能通过 ...

  8. React + Reflux 渲染性能优化原理

    作者:ManfredHu 链接:http://www.manfredhu.com/2016/11/08/23-reactRenderingPrinciple 声明:版权所有,转载请保留本段信息,否则请 ...

  9. 为golang程序使用pprof远程查看httpserver运行堆栈,cpu耗时等信息

    pprof是个神马玩意儿? pprof - manual page for pprof (part of gperftools) 是gperftools工具的一部分 gperftools又是啥? Th ...

随机推荐

  1. jquery 清除内容

    jQuery empty() 方法删除被选元素的子元素. $("#div1").empty(); 清空文本框的值 $("#password").val(&quo ...

  2. JS高级---案例:验证表单

    案例:验证表单 <!DOCTYPE html> <html lang="en"> <head> <meta charset="U ...

  3. 巨杉Tech | 微服务趋势下的数据库设计与应用简析

    周五(7月12日)巨杉数据库参与了由得到App主办八里庄技术沙龙活动,分享主题是关于分布式数据库架构与实战. 以下就是根据巨杉数据库现场分享的内容进行的分享实录整理. 巨杉数据库简介 巨杉,专注新一代 ...

  4. 【Node】Webpack调试启动

    "start": "webpack-dev-server --port 33333 --content-base ./dist",

  5. 棋盘划分问题中4的k次方减一是三的倍数

    1.数学归纳法(万物皆可数学归纳) ①当n=1时:4-1=3(是三的倍数) ②假设n-1成立证明n成立:4n-1=4n-1*(4-1)+4n-1-1 =3*4n-1+(4n-1-1) 所以4n-1%3 ...

  6. Map中放入对象字符串转义问题

    在做Zuul网关日志处理的时候,有以下需求: (1)记录请求成功的日志,要求记录请求返回的结果. 遇到的问题: (1)当请求的结果事对象时,会将其转成字符串,在put进map的时候,字符串就会被转义 ...

  7. 【Python】BMI指数 计算器

    身体质量指数 (Body Mass Index, 简称BMI), 亦称克托莱指数, 是目前国际上常用的衡量人体胖瘦程度以及是否健康的一个标准.BMI 值超标,意味着你必须减肥了. 在线版:https: ...

  8. c#数据筛选和排序

    一.TreeView SelectedNode    选中的节点            Level    节点的深度(从0开始)                AfterSelect    节点选中后 ...

  9. java-日期取特定值

    import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; /** * @author G ...

  10. word doc转pdf

    from win32com.client import constants, gencache # TODO pip install pywin32 -i http://mirrors.aliyun. ...