几乎所有的 RPC 框架都宣称自己是“高性能”的, 那么实际结果到底如何呢, 让我们来做一个性能测试吧.
项目地址: https://github.com/hank-whu/rpc-benchmark
测试说明
- 仅限于Java.
- 客户端使用JMH进行压测, 32 线程, 10 次预热, 3 次运行.
- 每次运行前都会执行 killall java, 但没有在每轮测试时重启操作系统.
- 所有类库版本在发布时都是最新的, 除非存在bug.
- 所有框架都尽量参考该项目自带的Benchmark实现.
- 将会一直持续, 不定期发布测试结果.
测试用例
- boolean existUser(String email), 判断某个 email 是否存在.
- boolean createUser(User user), 添加一个 User.
- User getUser(long id), 根据 id 获取一个用户.
- 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 是否存在
framework |
thrpt (ops/ms) |
avgt (ms) |
p90 (ms) |
p99 (ms) |
p999 (ms) |
turbo-rpc |
107.05 |
0.28 |
0.40 |
0.87 |
4.06 |
netty |
99.81 |
0.32 |
0.40 |
0.52 |
1.16 |
jupiter |
73.07 |
0.44 |
0.66 |
1.49 |
2.92 |
undertow |
70.38 |
0.45 |
1.16 |
2.17 |
32.48 |
turbo-rest |
68.49 |
0.44 |
1.17 |
2.15 |
25.66 |
undertow-async |
62.65 |
0.49 |
1.14 |
2.41 |
24.84 |
dubbo-kryo |
57.35 |
0.53 |
0.67 |
1.02 |
11.65 |
rapidoid |
52.96 |
0.61 |
1.32 |
2.51 |
25.07 |
dubbo |
52.12 |
0.54 |
0.67 |
0.92 |
3.93 |
motan |
44.96 |
0.71 |
1.15 |
2.47 |
33.39 |
aeron |
43.46 |
0.90 |
1.32 |
5.10 |
14.29 |
grpc |
38.97 |
0.84 |
1.07 |
1.31 |
6.06 |
thrift |
27.25 |
1.59 |
0.16 |
64.87 |
122.83 |
hprose |
26.24 |
1.26 |
1.53 |
2.01 |
8.34 |
springwebflux |
22.39 |
1.42 |
2.27 |
3.19 |
17.20 |
springboot |
12.54 |
1.68 |
2.38 |
13.63 |
33.20 |
createUser 添加一个 User
framework |
thrpt (ops/ms) |
avgt (ms) |
p90 (ms) |
p99 (ms) |
p999 (ms) |
turbo-rpc |
84.95 |
0.39 |
0.50 |
1.45 |
4.01 |
netty |
76.45 |
0.48 |
0.49 |
0.79 |
1.87 |
jupiter |
64.57 |
0.50 |
0.68 |
1.37 |
2.79 |
undertow |
62.47 |
0.51 |
1.17 |
2.76 |
20.10 |
turbo-rest |
58.21 |
0.57 |
1.23 |
2.84 |
22.35 |
undertow-async |
56.19 |
0.59 |
1.36 |
3.73 |
24.50 |
dubbo-kryo |
42.37 |
0.72 |
0.94 |
1.33 |
16.75 |
motan |
42.16 |
0.79 |
1.23 |
2.39 |
30.97 |
grpc |
41.56 |
0.77 |
0.93 |
1.24 |
4.41 |
aeron |
37.74 |
0.89 |
1.35 |
3.85 |
22.98 |
dubbo |
28.75 |
1.13 |
1.42 |
1.82 |
16.06 |
thrift |
25.66 |
1.47 |
0.17 |
68.71 |
130.93 |
hprose |
23.30 |
1.31 |
1.44 |
2.28 |
13.36 |
rapidoid |
18.54 |
1.73 |
1.27 |
25.10 |
40.47 |
springwebflux |
10.51 |
1.50 |
2.33 |
3.37 |
21.30 |
springboot |
9.43 |
1.75 |
2.57 |
12.81 |
24.90 |
getUser 根据 id 获取一个用户
framework |
thrpt (ops/ms) |
avgt (ms) |
p90 (ms) |
p99 (ms) |
p999 (ms) |
turbo-rpc |
95.92 |
0.38 |
0.49 |
1.52 |
2.96 |
jupiter |
63.61 |
0.52 |
0.74 |
1.37 |
2.50 |
netty |
63.44 |
0.44 |
0.50 |
0.55 |
0.97 |
undertow-async |
57.50 |
0.58 |
1.23 |
2.32 |
5.02 |
undertow |
55.70 |
0.55 |
1.32 |
2.54 |
11.60 |
turbo-rest |
53.34 |
0.59 |
1.49 |
2.72 |
23.69 |
dubbo-kryo |
46.44 |
0.69 |
0.85 |
1.16 |
18.09 |
rapidoid |
43.84 |
0.74 |
1.99 |
4.78 |
18.35 |
grpc |
41.58 |
0.75 |
0.90 |
1.19 |
4.57 |
motan |
40.62 |
0.78 |
1.25 |
2.68 |
34.18 |
dubbo |
29.11 |
1.11 |
1.44 |
1.98 |
16.73 |
thrift |
27.14 |
1.74 |
0.19 |
0.29 |
362.63 |
hprose |
23.91 |
1.40 |
1.56 |
2.31 |
47.06 |
springwebflux |
19.24 |
1.67 |
2.70 |
3.62 |
14.94 |
springboot |
18.71 |
1.70 |
2.17 |
14.76 |
31.09 |
aeron |
18.25 |
1.71 |
3.94 |
13.15 |
63.77 |
listUser 获取用户列表
framework |
thrpt (ops/ms) |
avgt (ms) |
p90 (ms) |
p99 (ms) |
p999 (ms) |
turbo-rpc |
44.53 |
0.82 |
1.37 |
2.85 |
10.39 |
grpc |
30.67 |
1.05 |
1.31 |
1.68 |
15.12 |
undertow |
28.38 |
1.21 |
1.72 |
4.49 |
23.25 |
motan |
28.08 |
1.13 |
1.80 |
3.22 |
21.56 |
undertow-async |
28.05 |
1.16 |
1.76 |
6.75 |
20.91 |
jupiter |
26.59 |
1.20 |
2.00 |
4.04 |
25.00 |
netty |
24.28 |
1.29 |
1.35 |
1.83 |
5.97 |
rapidoid |
20.73 |
1.56 |
3.29 |
16.50 |
29.89 |
dubbo-kryo |
19.55 |
1.69 |
2.36 |
3.37 |
16.85 |
turbo-rest |
17.56 |
2.17 |
2.67 |
17.02 |
37.50 |
springwebflux |
16.21 |
2.00 |
3.13 |
4.90 |
17.66 |
springboot |
15.84 |
2.16 |
2.72 |
16.81 |
36.64 |
thrift |
14.87 |
2.61 |
0.26 |
0.42 |
518.96 |
hprose |
13.19 |
2.70 |
2.85 |
4.01 |
54.52 |
aeron |
4.53 |
7.13 |
10.42 |
16.47 |
30.30 |
dubbo |
4.52 |
7.04 |
9.06 |
12.52 |
16.02 |
免责声明
- 能力所限错误在所难免, 本测试用例及测试结果仅供参考.
- 如果你认为xx框架的代码或配置存在问题,那么欢迎发起Pull Request.
- 利益相关: 本测试用例作者同时为 turbo, undertow-async 的作者.
网友评论