HttpServer性能比较
在自己的本子上随便测了下几款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性能比较的更多相关文章
- HttpServer带阻塞性能比较
服务端在返回hello,world! 之前先阻塞一秒钟,模拟访问DB等耗时操作. Netty 我直接在 WorkerGroup 里头sleep,用同步阻塞线程模型的方式来编程,所以性能暴降. Joob ...
- 提升 web 应用程序的性能(二)
最佳实践 本章将略述能帮助您提升 web 应用程序性能的最佳实践. 减少 HTTP 请求数 每个 HTTP 请求都有开销,包括查找 DNS.创建连接及等待响应,因此削减不必要的请求数可减少不必要的开销 ...
- PHP使用libevent实现高性能httpServer
今天发现php也有一个libevent的扩展,安装后尝试下了一个webserver(httpserver), 发现性能还不错,逻辑很简单,每秒响应速度1800~4000次/s 代码如下 <?ph ...
- Flask, Tornado, GEvent, 以及它们的结合的性能比较
Flask, Tornado, GEvent, 以及它们的结合的性能比较 英文: http://blog.wensheng.com/2011/10/performance-of-flask-torna ...
- vertx的HttpServer模块
Start HttpServer /** * 启动 HttpServer * multi instances 采用 synchronized防止线程安全问题 * addHandlers 方法是acto ...
- Flask性能优化对比
基于Flask的网关:Flask,Uwsgi,Gevent,Gunicorn(gevent),Tornado,Twisted !/usr/bin/python -- coding:utf-8 -- 美 ...
- Netty和Tomcat的区别、性能对比
一.Netty和Tomcat有什么区别? Netty和Tomcat最大的区别就在于通信协议,Tomcat是基于Http协议的,他的实质是一个基于http协议的web容器,但是Netty不一样,他能通过 ...
- React + Reflux 渲染性能优化原理
作者:ManfredHu 链接:http://www.manfredhu.com/2016/11/08/23-reactRenderingPrinciple 声明:版权所有,转载请保留本段信息,否则请 ...
- 为golang程序使用pprof远程查看httpserver运行堆栈,cpu耗时等信息
pprof是个神马玩意儿? pprof - manual page for pprof (part of gperftools) 是gperftools工具的一部分 gperftools又是啥? Th ...
随机推荐
- Failed to restart docker.service: Unit not found 镜像加速
解决方案 以前的安装残留 重新安装 find / -name "docker*" centos8 添加软件源信息 yum-config-manager --add-repo htt ...
- PP: Think globally, act locally: A deep neural network approach to high-dimensional time series forecasting
Problem: high-dimensional time series forecasting ?? what is "high-dimensional" time serie ...
- Win10 JDK 环境变量配置
1.安装JDK 到指定的目录 2.配置环境变量 2.1 配置 CLASSPATH .;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar; 2. ...
- cookie和会话
一.为什么要使用cookie和会话 HTTP是一种无状态技术,这意味着每个单独的HTNML页面都是一个无关的.当人们穿过站点时,HTTP 没有用于跟踪用户或保持变量的方法,尽管浏览器会跟踪你访问过的页 ...
- Importing data in R 1
目录 Importing data in R 学习笔记1 flat files:CSV txt文件 packages:readr read_csv() read_tsv read_delim() da ...
- spring微服务实战 - 1 一个完整的HTTP JSON REST服务
import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.Spr ...
- c语言修炼之一
1.C项目要高内聚(模块功能必须明确,一个模块完成一个功能).低耦合(接口尽可能简单,减少各模块间的联系). 2.register类型不能为模块间的全局变量.模块内的全局变量.局部static变量.( ...
- 怎么解析后台返回数据中\r\n换行
给div添加css样式, white-space: pre-wrap; 即可 文章来源:刘俊涛的博客 欢迎关注公众号.留言.评论,一起学习. _________________________ ...
- python3练习100题——003
今天继续-答案都会通过python3测试- 原题链接:http://www.runoob.com/python/python-exercise-example3.html 题目:一个整数,它加上100 ...
- Linux就该这么学(第一天)
原文地址:https://www.linuxprobe.com/chapter-01.html 最近想着要发布原来做的一个javaweb小项目 域名 云服务器都买好了,然后很尴尬,不会在云服务器上搭建 ...