Skip to content

airframe-grpc: Support gRPC backend#1192

Merged
xerial merged 16 commits intowvlet:masterfrom
xerial:grpc
Jul 28, 2020
Merged

airframe-grpc: Support gRPC backend#1192
xerial merged 16 commits intowvlet:masterfrom
xerial:grpc

Conversation

@xerial
Copy link
Copy Markdown
Member

@xerial xerial commented Jul 26, 2020

Added an experimental implementation of gRPC backend:

  • Use airframe-codec for gRPC request/response serialization
  • Build gRPC server based on Airframe RPC router
  • Add gRPC server factory

TODO in another PR:

  • Generate gRPC client stub wiht sbt-airframe plugin.
  • Support client, server-side, and bidirectional streaming
  • Add a gRPC server proxy with airframe-http-finagle for supporting HTTP1

@xerial xerial marked this pull request as draft July 26, 2020 06:31
@codecov
Copy link
Copy Markdown

codecov Bot commented Jul 26, 2020

Codecov Report

Merging #1192 into master will increase coverage by 0.08%.
The diff coverage is 80.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1192      +/-   ##
==========================================
+ Coverage   82.95%   83.03%   +0.08%     
==========================================
  Files         283      288       +5     
  Lines       10962    11018      +56     
  Branches      727      740      +13     
==========================================
+ Hits         9093     9149      +56     
  Misses       1869     1869              
Impacted Files Coverage Δ
...wvlet/airframe/http/router/HttpRequestMapper.scala 97.56% <ø> (ø)
.../main/scala/wvlet/airframe/http/router/Route.scala 83.33% <ø> (ø)
...la/wvlet/airframe/http/grpc/StringMarshaller.scala 66.66% <66.66%> (ø)
...a/wvlet/airframe/http/grpc/RPCRequestHandler.scala 68.75% <68.75%> (ø)
...in/scala/wvlet/airframe/http/grpc/GrpcServer.scala 76.92% <76.92%> (ø)
...src/main/scala/wvlet/airframe/http/grpc/Grpc.scala 100.00% <100.00%> (ø)
.../wvlet/airframe/http/grpc/GrpcServiceBuilder.scala 100.00% <100.00%> (ø)
... and 5 more

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 51113d6...784da50. Read the comment docs.

@xerial xerial marked this pull request as ready for review July 27, 2020 01:31
@xerial xerial requested review from a team, shimamoto and takezoe July 27, 2020 01:33
Comment thread docs/airframe-rpc.md Outdated
Copy link
Copy Markdown
Member

@takezoe takezoe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xerial I don't have any comments on the implementation for now. Rather, I would like to ask a question about the motivation of this gRPC backend. In my understanding, one of major advantages of gRPC is interoperability with many other languages based on ProtocolBuffer. Can we offer or leverage this advantage with this backend?

For example, if we can generate Protobuf-IDL from Airframe-RPC endpoint definition, we might be able to benefit from gRPC interoperability by implementing MessagePack marshaller for other languages.

@xerial
Copy link
Copy Markdown
Member Author

xerial commented Jul 27, 2020

Good point!

The initial motivation is leveraging HTTP2 and server/client-side streaming of gRPC so that we can build fast and interactive RPC services.

Generating a Protobuf IDL from an Airframe RPC interface looks promising and should be easy. What we need to do will be adding a filter for converting Protobuf requests into MessagePack requests (like airframe-codec) to call RPC methods. Then we can leverage existing gRPC client generators for various programming languages. I think most of the people who are already familiar with gRPC will be interested in this direction (Airframe RPC -> Protobuf IDL -> Protobuf gRPC client).

For Scala/Java users, we need to provide sbt-airframe Airframe gRPC client generator, which should be the most efficient client implementation.

Copy link
Copy Markdown
Collaborator

@shimamoto shimamoto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good so far. In terms of Airframe RPC, I think it's great to use this in almost the same manner.

@xerial xerial merged commit 3670cc7 into wvlet:master Jul 28, 2020
@xerial xerial mentioned this pull request Aug 13, 2020
76 tasks
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.

4 participants