当前位置: 首页 > 工具软件 > turbo-rpc > 使用案例 >

RPC框架性能PK,ServiceComb表现亮眼

皇甫卓君
2023-12-01

我们通常看到每个RPC框架介绍时都宣称“高性能”,到底哪个框架性能更好,很难得到明确答案。因为不同框架一般都有特别适合自己的测试场景,在特定场景下性能表现突出,其实说明不了问题。

为了相对准确评估不同框架性能,有网友做了一个性能基准测试,测试结果表明ServiceComb比大多主流服务框架有明显性能优势。

测试说明

  • 仅限于 Java

  • 客户端使用 JMH 进行压测, 32 线程, 3 轮预热 3 轮测试, 每轮 10s

  • 每次运行前都会执行 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), 获取用户列表

运行结果

  • 生成时间: 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

frameworkthrpt (ops/ms)avgt (ms)p90 (ms)p99 (ms)p999 (ms)
netty164.5750.1940.2590.3440.442
turbo-rpc161.5110.1990.2620.3530.452
servicecomb110.1660.2930.340.4181.288
thrift101.3980.310.5971.121.626
undertow89.6280.3630.821.4251.907
turbo-rest85.8110.3710.7911.3562.009
armeria82.970.3890.7461.1982.52
undertow-async80.0640.4070.91.5592.785
motan77.7890.4130.5540.8084.043
springwebflux55.1410.590.7290.8314.071
springboot-undertow49.4490.6560.8215.0317.138
rapidoid48.6220.714451.412905.971350.566
sofa46.3290.6930.8991.375.587
springboot42.5910.7751.0634.71911.193
hprose40.3070.810.5062.41944.237
grpc24.9281.311.6061.7332.114
dubboNaNNaNNaNNaNNaN
dubbo-kryoNaNNaNNaNNaNNaN

createUser

frameworkthrpt (ops/ms)avgt (ms)p90 (ms)p99 (ms)p999 (ms)
netty154.9110.2090.2680.3560.463
turbo-rpc147.8890.2170.2840.3780.509
servicecomb104.8360.3070.360.4491.384
thrift97.3850.330.6331.1861.735
undertow86.650.3530.8091.3911.964
turbo-rest84.6580.3790.8111.382.273
armeria79.60.3970.6521.1122.826
undertow-async78.5270.4130.91.542.843
motan73.3320.4290.5890.8564.603
springwebflux52.1090.6190.7560.874.284
springboot-undertow45.1750.7131.0474.42413.785
springboot42.2680.7921.0794.70211.796
sofa40.1430.7960.9941.3765.571
hprose36.7480.9610.54641.87844.433
dubbo24.3821.3171.6791.9013.998
dubbo-kryo23.3511.3521.7511.89619.464
grpc22.7521.3661.6221.7592.283
rapidoid0.249143.8862336.2273229.6143670.016

getUser

frameworkthrpt (ops/ms)avgt (ms)p90 (ms)p99 (ms)p999 (ms)
netty151.6530.2120.2780.3830.492
turbo-rpc147.8620.2150.2920.3910.496
servicecomb106.2510.3060.3590.4491.376
thrift97.9360.3310.6311.1821.761
undertow85.7060.3710.8271.4251.722
turbo-rest82.7290.3890.8571.4542.13
armeria82.2620.40.7211.1282.384
undertow-async79.8680.4110.8731.4931.997
motan72.9610.4470.5690.8344.53
springwebflux52.110.6190.7520.8493.322
hprose50.0010.6670.7341.07542.336
rapidoid46.5580.767448.791897.5811367.2
springboot-undertow45.4950.7110.8985.35819.595
sofa40.5110.8011.0171.3646.398
springboot39.2080.8291.1574.99711.747
dubbo24.4131.3051.451.7063.228
grpc24.1871.2661.5831.7552.251
dubbo-kryoNaNNaNNaNNaNNaN

listUser

frameworkthrpt (ops/ms)avgt (ms)p90 (ms)p99 (ms)p999 (ms)
netty73.3030.4310.9091.2232.09
turbo-rpc67.420.4561.1551.3821.991
thrift62.2480.520.9771.8724.235
servicecomb54.6470.5830.8061.2193.912
undertow52.2550.6111.4382.3475.784
undertow-async50.2350.6271.552.6876.717
armeria48.2410.6611.0391.8556.197
motan44.2010.7230.9851.4585.972
springwebflux38.3530.8341.0061.2575.333
turbo-rest36.1020.8832.0014.1867.995
grpc27.2861.1661.2861.3894.16
springboot-undertow27.1841.1581.4757.40619.431
rapidoid26.6651.44448.791892.3381780.482
springboot25.041.2581.7126.26711.78
hprose22.5291.3841.5131.81924.62
dubbo-kryo16.521.9041.9972.49942.729
sofa12.2762.6223.8227.13512.321
dubbo3.7168.7279.40410.20728.312

更新说明

  1. 硬件升级到8核

  2. jdk 升级为 AdoptOpenJDK-11.0.2

  3. 各个框架均升级到最新版本

免责声明

  • 能力所限错误在所难免, 本测试用例及测试结果仅供参考

  • 如果你认为 xxx 框架的代码或配置存在问题,那么欢迎发起 Pull Request

  • 利益相关: 本测试用例作者同时为 turbo undertow-async 的作者

测试代码

代码在github上,感谢作者的辛苦付出,对我们准确评估服务框架性能有重要参考价值。

 类似资料: