Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can gRPC server run on top of another HTTP/2 web server like jetty/undertow/tomcat?

I'm considering using gRPC for a b2b API and I can't quite figure out if gRPC server can run on top of another http2 capable web server?

In the examples provided on the official site the gRPC API is always running on its internal netty based server on a particular port.

So, if let's say I have several gRPC applications it looks like I'd have to run them on separate ports.

But I would like to have a single API entry point (a web server like jetty on a single port 443) that would manage the URLs and map them to the particular gRPC service implementation.

Is it possible with gRPC?

like image 488
spoonboy Avatar asked Mar 28 '16 08:03

spoonboy


1 Answers

No, grpc-java cannot respond to RPCs as a servlet.

Servlet containers supporting HTTP/2 are very new and gRPC hasn't investigated them much yet. It does seem feasible to use the async servlet APIs to implement a gRPC server (as an alternative to the Netty server), except possibly for trailers. It's not 100% clear how to send trailers when the server is HTTP/2, since a common technique with HTTP/1 was for the servlet to manually perform chunked encoding which does not exist in HTTP/2. In any case, it isn't implemented.

Edit: An issue is now open GitHub.

like image 131
Eric Anderson Avatar answered Oct 17 '22 04:10

Eric Anderson