RPC Benchmark Round 1

几乎所有的 RPC 框架都宣称自己是“高性能”的, 那么实际结果到底如何呢, 让我们来做一个性能测试吧.

项目地址: https://github.com/hank-whu/rpc-benchmark

测试说明

  • 仅限于Java.
  • 客户端使用JMH进行压测, 32 线程, 10 次预热, 3 次运行.
  • 每次运行前都会执行 killall java, 但没有在每轮测试时重启操作系统.
  • 所有类库版本在发布时都是最新的, 除非存在bug.
  • 所有框架都尽量参考该项目自带的Benchmark实现.
  • 将会一直持续, 不定期发布测试结果.

测试用例

  1. boolean existUser(String email), 判断某个 email 是否存在.
  2. boolean createUser(User user), 添加一个 User.
  3. User getUser(long id), 根据 id 获取一个用户.
  4. Page<User> listUser(int pageNo), 获取用户列表.

运行结果

生成时间: 2018-01-28 14:36:24.

硬件环境: 阿里云 ecs.c4.xlarge, Intel Xeon E5-2667v4, 4CPU 8GB RAM 两台.

软件环境: Ubuntu x64 16.04.5, Java HotSpot(TM) 64-Bit Server VM 9.0.4+11.

启动参数: java -server -Xmx1g -Xms1g -XX:MaxDirectMemorySize=1g -XX:+UseG1GC.

existUser 判断某个 email 是否存在

frameworkthrpt (ops/ms)avgt (ms)p90 (ms)p99 (ms)p999 (ms)
turbo-rpc107.050.280.400.874.06
netty99.810.320.400.521.16
jupiter73.070.440.661.492.92
undertow70.380.451.162.1732.48
turbo-rest68.490.441.172.1525.66
undertow-async62.650.491.142.4124.84
dubbo-kryo57.350.530.671.0211.65
rapidoid52.960.611.322.5125.07
dubbo52.120.540.670.923.93
motan44.960.711.152.4733.39
aeron43.460.901.325.1014.29
grpc38.970.841.071.316.06
thrift27.251.590.1664.87122.83
hprose26.241.261.532.018.34
springwebflux22.391.422.273.1917.20
springboot12.541.682.3813.6333.20

createUser 添加一个 User

frameworkthrpt (ops/ms)avgt (ms)p90 (ms)p99 (ms)p999 (ms)
turbo-rpc84.950.390.501.454.01
netty76.450.480.490.791.87
jupiter64.570.500.681.372.79
undertow62.470.511.172.7620.10
turbo-rest58.210.571.232.8422.35
undertow-async56.190.591.363.7324.50
dubbo-kryo42.370.720.941.3316.75
motan42.160.791.232.3930.97
grpc41.560.770.931.244.41
aeron37.740.891.353.8522.98
dubbo28.751.131.421.8216.06
thrift25.661.470.1768.71130.93
hprose23.301.311.442.2813.36
rapidoid18.541.731.2725.1040.47
springwebflux10.511.502.333.3721.30
springboot9.431.752.5712.8124.90

getUser 根据 id 获取一个用户

frameworkthrpt (ops/ms)avgt (ms)p90 (ms)p99 (ms)p999 (ms)
turbo-rpc95.920.380.491.522.96
jupiter63.610.520.741.372.50
netty63.440.440.500.550.97
undertow-async57.500.581.232.325.02
undertow55.700.551.322.5411.60
turbo-rest53.340.591.492.7223.69
dubbo-kryo46.440.690.851.1618.09
rapidoid43.840.741.994.7818.35
grpc41.580.750.901.194.57
motan40.620.781.252.6834.18
dubbo29.111.111.441.9816.73
thrift27.141.740.190.29362.63
hprose23.911.401.562.3147.06
springwebflux19.241.672.703.6214.94
springboot18.711.702.1714.7631.09
aeron18.251.713.9413.1563.77

listUser 获取用户列表

frameworkthrpt (ops/ms)avgt (ms)p90 (ms)p99 (ms)p999 (ms)
turbo-rpc44.530.821.372.8510.39
grpc30.671.051.311.6815.12
undertow28.381.211.724.4923.25
motan28.081.131.803.2221.56
undertow-async28.051.161.766.7520.91
jupiter26.591.202.004.0425.00
netty24.281.291.351.835.97
rapidoid20.731.563.2916.5029.89
dubbo-kryo19.551.692.363.3716.85
turbo-rest17.562.172.6717.0237.50
springwebflux16.212.003.134.9017.66
springboot15.842.162.7216.8136.64
thrift14.872.610.260.42518.96
hprose13.192.702.854.0154.52
aeron4.537.1310.4216.4730.30
dubbo4.527.049.0612.5216.02

免责声明

  • 能力所限错误在所难免, 本测试用例及测试结果仅供参考.
  • 如果你认为xx框架的代码或配置存在问题,那么欢迎发起Pull Request.
  • 利益相关: 本测试用例作者同时为 turbo, undertow-async 的作者.
    原文作者:鲁小憨
    原文地址: https://www.jianshu.com/p/18c95649b1a4
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞