Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

airframe-grpc: Add benchmark for grpc-java #1251

Merged
merged 6 commits into from Aug 21, 2020
Merged

Conversation

xerial
Copy link
Member

@xerial xerial commented Aug 21, 2020

Add a benchmark for ScalaPB. airframe-grpc seems faster than ScalaPB:

$ ./sbt airframe-benchmark/pack
$ ./airframe-benchmark/target/pack/bin/airframe-benchmark bench http -mt 5s

Benchmark                   Mode  Cnt      Score      Error  Units
FinagleBenchmark.rpcAsync  thrpt   10  16873.366 ± 3370.694  ops/s
FinagleBenchmark.rpcSync   thrpt   10   4344.363 ± 1878.053  ops/s
GrpcBenchmark.rpcAsync     thrpt   10  45615.096 ± 8768.244  ops/s
GrpcBenchmark.rpcSync      thrpt   10   7564.656 ± 1729.330  ops/s
ScalaPBBenchmark.rpcAsync  thrpt   10  23550.051 ± 3981.219  ops/s
ScalaPBBenchmark.rpcSync   thrpt   10   6910.494 ± 2075.070  ops/s

Update

Added grpc-java benchmark: grpc-java > Airframe gRPC > ScalaPB > Airframe Finagle backend

Benchmark                    Mode  Cnt      Score      Error  Units
FinagleBenchmark.rpcAsync   thrpt   10  12877.679 ± 2280.745  ops/s
FinagleBenchmark.rpcSync    thrpt   10   3733.563 ± 2265.317  ops/s
GrpcBenchmark.rpcAsync      thrpt   10  38908.675 ± 7801.493  ops/s
GrpcBenchmark.rpcSync       thrpt   10   6450.686 ± 2309.432  ops/s
GrpcJavaBenchmark.rpcAsync  thrpt   10  40347.400 ± 5854.749  ops/s
GrpcJavaBenchmark.rpcSync   thrpt   10   7746.578 ± 1782.496  ops/s
ScalaPBBenchmark.rpcAsync   thrpt   10  33119.282 ± 4465.012  ops/s
ScalaPBBenchmark.rpcSync    thrpt   10   5829.727 ± 1224.763  ops/s

Update 2

I found increasing the warmup time is better to get more stable results:

$ ./airframe-benchmark/target/pack/bin/airframe-benchmark bench http -w 5 -wt 3s -i 10 -mt 3s
Benchmark                  Mode  Cnt      Score      Error  Units
AirframeFinagle.rpcAsync  thrpt   10  14904.490 ± 2196.030  ops/s
AirframeFinagle.rpcSync   thrpt   10   4782.204 ±  483.637  ops/s
AirframeGrpc.rpcAsync     thrpt   10  37862.733 ± 2934.370  ops/s
AirframeGrpc.rpcSync      thrpt   10   7081.288 ±  299.102  ops/s
GrpcJava.rpcAsync         thrpt   10  44996.516 ± 1925.843  ops/s
GrpcJava.rpcSync          thrpt   10   8028.098 ±  274.139  ops/s
ScalaPB.rpcAsync          thrpt   10  36235.851 ± 1920.768  ops/s
ScalaPB.rpcSync           thrpt   10   7281.567 ±  578.542  ops/s

grpc-java was the fastest. Airframe gRPC or ScalaPB has 10%~20% overhead compared to grpc-java.

These should be the major factors causing these performance differences:

  • GrpcJava.rpcSync, ScalaPB.rpcSync difference <- ScalaPB's marshaller. (10% overhead)
  • GrpcJava.rpcAsync, ScalaPB.rpcAsync difference <- ScalaPB's marshaller + Scala Future's overhead (20%)
  • GrpcJava, AirframeGrpc <- Difference between Protobuf or MessagePack + reflection call overhead of Airframe RPC (15%)

@codecov
Copy link

codecov bot commented Aug 21, 2020

Codecov Report

Merging #1251 into master will increase coverage by 0.00%.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1251   +/-   ##
=======================================
  Coverage   83.37%   83.37%           
=======================================
  Files         298      298           
  Lines       11471    11472    +1     
  Branches      716      703   -13     
=======================================
+ Hits         9564     9565    +1     
  Misses       1907     1907           
Impacted Files Coverage Δ
...shared/src/main/scala/wvlet/log/io/StopWatch.scala 80.20% <0.00%> (+0.20%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 942f11e...2923a2d. Read the comment docs.

@xerial
Copy link
Member Author

xerial commented Aug 21, 2020

CI failed because ScalaPB doesn't support Scala 2.11

@xerial
Copy link
Member Author

xerial commented Aug 21, 2020

For comparison, added grpc-java futureStub. Guava's Future seems has some overhead, but it still fast enough:

Benchmark                  Mode  Cnt      Score      Error  Units
AirframeFinagle.rpcAsync  thrpt   10  16543.625 ± 1734.088  ops/s
AirframeFinagle.rpcSync   thrpt   10   5488.840 ±  388.751  ops/s
AirframeGrpc.rpcAsync     thrpt   10  46084.015 ± 2349.381  ops/s
AirframeGrpc.rpcSync      thrpt   10   7840.921 ±  292.527  ops/s
GrpcJava.rpcAsync         thrpt   10  52858.722 ± 2588.338  ops/s
GrpcJava.rpcFutureAsync   thrpt   10  47441.621 ± 2164.743  ops/s
GrpcJava.rpcSync          thrpt   10   9981.824 ±  319.595  ops/s
ScalaPB.rpcAsync          thrpt   10  41570.966 ± 1512.182  ops/s
ScalaPB.rpcSync           thrpt   10   8565.175 ±  391.477  ops/s

@xerial xerial changed the title airframe-grpc: Add benchmark for ScalaPB airframe-grpc: Add benchmark for grpc-java Aug 21, 2020
@xerial
Copy link
Member Author

xerial commented Aug 21, 2020

Removed ScalaPB benchmark as it doesn't support Scala 2.11

@xerial xerial merged commit 8ddf320 into wvlet:master Aug 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant