RPC框架性能PK,ServiceComb表现亮眼
我们通常看到每个RPC框架介绍时都宣称“高性能”,到底哪个框架性能更好,很难得到明确答案。因为不同框架一般都有特别适合自己的测试场景,在特定场景下性能表现突出,其实说明不了问题。
为了相对准确评估不同框架性能,有网友做了一个性能基准测试,测试结果表明ServiceComb比大多主流服务框架有明显性能优势。
测试说明
仅限于 Java
客户端使用 JMH 进行压测, 32 线程, 3 轮预热 3 轮测试, 每轮 10s
每次运行前都会执行 killall java, 但没有在每轮测试时重启操作系统
所有类库版本在发布时都是最新的, 除非存在 bug
所有框架都尽量参考该项目自带的 Benchmark 实现
将会一直持续, 不定期发布测试结果
测试用例
boolean existUser(String email), 判断某个 email 是否存在
boolean createUser(User user), 添加一个 User
User getUser(long id), 根据 id 获取一个用户
Page<User> listUser(int pageNo), 获取用户列表
运行结果
生成时间: 2019-02-11 21:56:27
硬件环境: 阿里云 ic5 ecs.ic5.2xlarge 8vCPU 8GB Intel Xeon(Skylake) Platinum 8163 2.5GHz 2.5Gbps 80万PPS
软件环境: Ubuntu x64 18.04, OpenJDK 64-Bit Server VM 11.0.2+9
启动参数: java -server -Xmx1g -Xms1g -XX:+UseG1GC
existUser
framework | thrpt (ops/ms) | avgt (ms) | p90 (ms) | p99 (ms) | p999 (ms) |
---|---|---|---|---|---|
netty | 164.575 | 0.194 | 0.259 | 0.344 | 0.442 |
turbo-rpc | 161.511 | 0.199 | 0.262 | 0.353 | 0.452 |
servicecomb | 110.166 | 0.293 | 0.34 | 0.418 | 1.288 |
thrift | 101.398 | 0.31 | 0.597 | 1.12 | 1.626 |
undertow | 89.628 | 0.363 | 0.82 | 1.425 | 1.907 |
turbo-rest | 85.811 | 0.371 | 0.791 | 1.356 | 2.009 |
armeria | 82.97 | 0.389 | 0.746 | 1.198 | 2.52 |
undertow-async | 80.064 | 0.407 | 0.9 | 1.559 | 2.785 |
motan | 77.789 | 0.413 | 0.554 | 0.808 | 4.043 |
springwebflux | 55.141 | 0.59 | 0.729 | 0.831 | 4.071 |
springboot-undertow | 49.449 | 0.656 | 0.821 | 5.03 | 17.138 |
rapidoid | 48.622 | 0.714 | 451.412 | 905.97 | 1350.566 |
sofa | 46.329 | 0.693 | 0.899 | 1.37 | 5.587 |
springboot | 42.591 | 0.775 | 1.063 | 4.719 | 11.193 |
hprose | 40.307 | 0.81 | 0.506 | 2.419 | 44.237 |
grpc | 24.928 | 1.31 | 1.606 | 1.733 | 2.114 |
dubbo | NaN | NaN | NaN | NaN | NaN |
dubbo-kryo | NaN | NaN | NaN | NaN | NaN |
createUser
framework | thrpt (ops/ms) | avgt (ms) | p90 (ms) | p99 (ms) | p999 (ms) |
---|---|---|---|---|---|
netty | 154.911 | 0.209 | 0.268 | 0.356 | 0.463 |
turbo-rpc | 147.889 | 0.217 | 0.284 | 0.378 | 0.509 |
servicecomb | 104.836 | 0.307 | 0.36 | 0.449 | 1.384 |
thrift | 97.385 | 0.33 | 0.633 | 1.186 | 1.735 |
undertow | 86.65 | 0.353 | 0.809 | 1.391 | 1.964 |
turbo-rest | 84.658 | 0.379 | 0.811 | 1.38 | 2.273 |
armeria | 79.6 | 0.397 | 0.652 | 1.112 | 2.826 |
undertow-async | 78.527 | 0.413 | 0.9 | 1.54 | 2.843 |
motan | 73.332 | 0.429 | 0.589 | 0.856 | 4.603 |
springwebflux | 52.109 | 0.619 | 0.756 | 0.87 | 4.284 |
springboot-undertow | 45.175 | 0.713 | 1.047 | 4.424 | 13.785 |
springboot | 42.268 | 0.792 | 1.079 | 4.702 | 11.796 |
sofa | 40.143 | 0.796 | 0.994 | 1.376 | 5.571 |
hprose | 36.748 | 0.961 | 0.546 | 41.878 | 44.433 |
dubbo | 24.382 | 1.317 | 1.679 | 1.901 | 3.998 |
dubbo-kryo | 23.351 | 1.352 | 1.751 | 1.896 | 19.464 |
grpc | 22.752 | 1.366 | 1.622 | 1.759 | 2.283 |
rapidoid | 0.249 | 143.886 | 2336.227 | 3229.614 | 3670.016 |
getUser
framework | thrpt (ops/ms) | avgt (ms) | p90 (ms) | p99 (ms) | p999 (ms) |
---|---|---|---|---|---|
netty | 151.653 | 0.212 | 0.278 | 0.383 | 0.492 |
turbo-rpc | 147.862 | 0.215 | 0.292 | 0.391 | 0.496 |
servicecomb | 106.251 | 0.306 | 0.359 | 0.449 | 1.376 |
thrift | 97.936 | 0.331 | 0.631 | 1.182 | 1.761 |
undertow | 85.706 | 0.371 | 0.827 | 1.425 | 1.722 |
turbo-rest | 82.729 | 0.389 | 0.857 | 1.454 | 2.13 |
armeria | 82.262 | 0.4 | 0.721 | 1.128 | 2.384 |
undertow-async | 79.868 | 0.411 | 0.873 | 1.493 | 1.997 |
motan | 72.961 | 0.447 | 0.569 | 0.834 | 4.53 |
springwebflux | 52.11 | 0.619 | 0.752 | 0.849 | 3.322 |
hprose | 50.001 | 0.667 | 0.734 | 1.075 | 42.336 |
rapidoid | 46.558 | 0.767 | 448.791 | 897.581 | 1367.2 |
springboot-undertow | 45.495 | 0.711 | 0.898 | 5.358 | 19.595 |
sofa | 40.511 | 0.801 | 1.017 | 1.364 | 6.398 |
springboot | 39.208 | 0.829 | 1.157 | 4.997 | 11.747 |
dubbo | 24.413 | 1.305 | 1.45 | 1.706 | 3.228 |
grpc | 24.187 | 1.266 | 1.583 | 1.755 | 2.251 |
dubbo-kryo | NaN | NaN | NaN | NaN | NaN |
listUser
framework | thrpt (ops/ms) | avgt (ms) | p90 (ms) | p99 (ms) | p999 (ms) |
---|---|---|---|---|---|
netty | 73.303 | 0.431 | 0.909 | 1.223 | 2.09 |
turbo-rpc | 67.42 | 0.456 | 1.155 | 1.382 | 1.991 |
thrift | 62.248 | 0.52 | 0.977 | 1.872 | 4.235 |
servicecomb | 54.647 | 0.583 | 0.806 | 1.219 | 3.912 |
undertow | 52.255 | 0.611 | 1.438 | 2.347 | 5.784 |
undertow-async | 50.235 | 0.627 | 1.55 | 2.687 | 6.717 |
armeria | 48.241 | 0.661 | 1.039 | 1.855 | 6.197 |
motan | 44.201 | 0.723 | 0.985 | 1.458 | 5.972 |
springwebflux | 38.353 | 0.834 | 1.006 | 1.257 | 5.333 |
turbo-rest | 36.102 | 0.883 | 2.001 | 4.186 | 7.995 |
grpc | 27.286 | 1.166 | 1.286 | 1.389 | 4.16 |
springboot-undertow | 27.184 | 1.158 | 1.475 | 7.406 | 19.431 |
rapidoid | 26.665 | 1.44 | 448.791 | 892.338 | 1780.482 |
springboot | 25.04 | 1.258 | 1.712 | 6.267 | 11.78 |
hprose | 22.529 | 1.384 | 1.513 | 1.819 | 24.62 |
dubbo-kryo | 16.52 | 1.904 | 1.997 | 2.499 | 42.729 |
sofa | 12.276 | 2.622 | 3.822 | 7.135 | 12.321 |
dubbo | 3.716 | 8.727 | 9.404 | 10.207 | 28.312 |
更新说明
硬件升级到8核
jdk 升级为 AdoptOpenJDK-11.0.2
各个框架均升级到最新版本
免责声明
能力所限错误在所难免, 本测试用例及测试结果仅供参考
如果你认为 xxx 框架的代码或配置存在问题,那么欢迎发起 Pull Request
利益相关: 本测试用例作者同时为 turbo undertow-async 的作者
测试代码
代码在github上,感谢作者的辛苦付出,对我们准确评估服务框架性能有重要参考价值。
- 点赞
- 收藏
- 关注作者
评论(0)