在自己的本子上随便测了下几款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. 文本harry potter的字符统计

    实现计算文件中字符的占比和不同单词的个数两项功能,首先将文本文件按行导入到程序中,再通过charAT()函数来实现对单个字符的操作,并用集合来统计字符总数以及不同的字符的个数,进而输出各个字符的个数以 ...

  2. 剑指offer 56.删除有序链表中的重复结点

    56. 删除有序链表中的重复结点 题目描述 在一个排序的链表中,存在重复的结点,请删除该链表中重复的结点,重复的结点不保留,返回链表头指针. 例如,链表1->2->3->3-> ...

  3. centos 部署 aspnetMVC 网页

    在Linux上运行ASP.NET网站或WebApi的传统步骤是,先安装libgdiplus,再安装mono,然后安装Jexus.在这个过程中,虽然安装Jexus是挺简便的一件事,但是安装mono就相对 ...

  4. MyEclipse启动Tomcat报错:Could not find the main class: org.apache.catalina.startup

    问题描述 Could not find the main class:org.apache.catalina.startup.Bootstrap. Program will exit 问题原因 主要原 ...

  5. 超简单的OpenGL & WebGL & Three.js介绍_1

    专业解释 什么是OpenGL OpenGL(Open Graphics Library即开放图形库或者“开放式图形库”)是用于渲染2D.3D矢量图形的跨语言.跨平台的应用程序编程接口(API). 这个 ...

  6. C++-POJ1995-Raising Modulo Numbers[快速幂]

    #include <cstdio> typedef long long ll; int quick_pow(ll a,ll b,ll mod){ ll ans=; ))ans=(ans*a ...

  7. Keep-Alive 以及服务器心跳

    Keep-Alive 来源 :http://www.nowamagic.net/academy/detail/23350305 服务器心跳  来源 :http://www.cnblogs.com/lw ...

  8. Docker(一)概念与基础

    Docker 基础 为什么需要docker?在传统部署下,我们会遇到不同机器.不同依赖版本的兼容性等问题,解决此问题一般会消耗大量时间,并且在不同机器上均要执行统一环境的部署也是一个耗时较长的工作.除 ...

  9. 编码 - 设置 win10 下 cmd 编码格式

    概述 cmd 编码格式修改 背景 之前尝试过修改 gitbash(mingw) 的 Character Set 这次尝试修改一下 cmd 的编码格式 准备 os win10.1903 1. 查看 当前 ...

  10. oracle 处理锁表,创建新的数据库实例

    select saddr,sid,serial#,paddr,username,status from v$session where username is not null and usernam ...