GRPC: A high performance, open source, general RPC framework
grpc.io
grpc.io
* No more required fields
* Now supports maps (a huge pain point)
* A canonical json encoding
* Wider official language support
[0] https://github.com/google/protobuf/releasesproto2 integration in Go is fairly unpleasant and involves getters and lots of pointers everywhere (see proto.Int, proto.String).
For when you actually want a nullable field, I think the idea is that it is easy to have a wrapper message (just like boxing in languages). Such wrappers could even be made standard and provided by protobuf.
They will be: https://github.com/google/protobuf/issues/159#issuecomment-7...
If this would work with juniversal[0], and if that's actually any good, then this might actually give a quick way of churning out cross-platform apps.
Regarding the gRPC release, I've looked at the examples in the repo and only found this: https://github.com/grpc/grpc-java/tree/master/integration-te.... While it's a great showcase for the power of gRPC, having a "hello world" example with, hopefully, not a whole lot of boilerplate, would help a lot selling this to my team.
The examples folder references a tutorial at https://github.com/grpc/grpc-common/blob/master/java/javatut...
In the past I've found HTTP (1.1) to be okay, but not great for server->server RPC. The semantics are fine (but overkill) and the overhead sort of sucks. With HTTP/2 I guess the performance should be a lot better (with a binary protocol); I'm still unsure about the HTTP semantics in a general RPC context. Anyone with deeper knowledge of HTTP/2 care to enlighten me?
(Following up on a twitter conversation I had with @bradfitz: https://twitter.com/calebspare/status/571049339541270529)
a11r pointed out several interesting features of HTTP/2 that are put to good use in gRPC, though.
Kenton does a pretty good job discussing this here https://capnproto.org/news/2014-06-17-capnproto-flatbuffers-...
and rightly mostly focuses on the message-encoding aspects. Performance will vary by use-case & platform and should be traded off against the suitability for the given use-case (platform support, schema evolution, fidelity of representation, maturity vs bleeding edge)
Cap'N'Proto has some interesting RPC features (promise-pipelining, pass-by-reference) that may be valuable to some.
FYI it would be perfectly reasonable to use Cap'N'Proto messages with GRPC as the transport layer to get HTTP2 support. GRPC was explicitly designed to allow for this.
Protobuf has better platform coverage than FlatBuffers and it's schema is easier to evolve but neither of these may matter for your use-case. As in all things it depends.
Automatically generate idiomatic client and server
stubs for your service in a variety of languages.
gRPC has libraries in ... C# [0]
Aweso- This gRPC C# implementation is work-in-
progress and is not expected to work yet.
[0] https://github.com/grpc/grpc/tree/master/src/csharpDoes this have a distinct advantage over websockets, does it supersede it or is completely different?
To put it another way, could gRPC have worked via websockets (or maybe some long-polling fallback mode).
While HTTP/1.1 was a poor transport for high-perf RPC there are many parts of it that make sense semantically (headers, trailers, mime-types, virtual-hosting, content-encoding specification etc). HTTP2 lets you continue to use those in a form everyone is familiar with, with Websocket you would have to invent them again.
Websockets also have frames, binary or text.
More specifically this means that multiple WebSockets are not multiplexed over a single TCP/IP socket. One physical connection per-Websocket is a real scalability issue for servers and proxies.
WebSocket-over-HTTP would address that. See the options being discussed here http://tools.ietf.org/html/draft-hirano-httpbis-websocket-ov...
You want to multiplex websockets (for RPC) with normal HTTP requests -> Works through different URLs.
If you want to multiplex different websocket RPC services on a single websocket endpoint it's easy to do this on application level with some kind of service identifiers. You will probably want those anyway for some purposes - even if your transport layer also provides multiplexing.
Want to multiplex different websocket connections -> Works through different URLs. Yes, each will require a seperate IP connection. However I don't see a lot of applications that will go and utilize this scenario. They will either use gRpc OR WAMP OR SignalR OR etc, because that will make the maintainability much better then with a very mixed technology stack.
One of the major reasons for the existence of WebSocket is to support duplex streaming. HTTP/2 explicitly states
"A server can send a complete response prior to the client sending an entire request if the response does not depend on any portion of the request that has not been sent and received"
With better HTTP APIs (particularly in the browser) you would get full-duplex and the need for WebSocket would diminsh.
Or, now that I think of it, would the modern recommendation for this lean more toward opening multiple parallel Server-Sent-Events streams, with each channel being its own HTTP resource? That seems more idiomatic, at least.
Using separately addressable resources and having HTTP2 do the connection multiplexing for you seems like a good pattern to me.
I think this makes a major difference for RPC applications, because with a single connection you have a guarantee that all messages will be retrieved in the same order that they were sent.
E.g. with a persistent websocket connection I have the guarantee that all messages will be in order. With mulitple HTTP/1.1 requests I don't have it. Don't know about HTTP/2.
And of course the requirements about such a thing depend on how you design your RPC API (stateless or not).
gRPC maps calls to streams so calls can proceed at different rates, but you still receive the information on a particular call in order. So conceptually each call is completely separate, but we can use a single HTTP/2 connection for all the calls to a particular destination.
Is this simply a consistent, cross-language looking interface for authoring/consuming Protocol Buffers services? What makes this different from other Protocol Buffer implementations?
- this is not a new Protocol Buffer implementation. It uses the existing Protocol Buffers implementation for serialization/deserialization.
- this is actual implementation for the service declarations you could write in .proto files already (previously Protocol Buffers could only generate interface stubs, without implementation).
Using HTTP/2 though also allows fitting into the wider web ecosystem of proxies, reverse proxies, load balancers/TLS terminators, and developer familiarity.
Which has these clauses:
Grant of Copyright License. Subject to the terms and conditions of this Agreement, You hereby grant to Google and to recipients of software distributed by Google a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, sublicense, and distribute Your Contributions and such derivative works.
Grant of Patent License. Subject to the terms and conditions of this Agreement, You hereby grant to Google and to recipients of software distributed by Google a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by You that are necessarily infringed by Your Contribution(s) alone or by combination of Your Contribution(s) with the Work to which such Contribution(s) was submitted. If any entity institutes patent litigation against You or any other entity (including a cross-claim or counterclaim in a lawsuit) alleging that your Contribution, or the Work to which you have contributed, constitutes direct or contributory patent infringement, then any patent licenses granted to that entity under this Agreement for that Contribution or Work shall terminate as of the date such litigation is filed.
But Google doesn't grant you the same perpetual right to use and patent licenses back to you if you use gRPC. So I worry that if I start using this code, and Google decides to pull it, they can, even if some of it came from work that I did on it.
Now before someone says "But Chuck, they wouldn't do that ..." I want to remind you that licenses and contracts are not written to cover the 'good' time where everyone likes everyone, they are written to cover the 'bad' time when for one reason or another (often entirely unrelated to a particular API) that people stop liking each other so much.
The fix is simple however, Google could put in their license just a bit of additional text, which replaces
"Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:"
With
"Redistribution, use, and sub-licensing for this code in source or binary form, with or without modification, is granted, without cost, non-exclusively, and in perpetuity, provided the following conditions are met:"
Is there someone from the project reading this that can get that wording updated?
2. "But Google doesn't grant you the same perpetual right to use and patent licenses back to you if you use gRPC"
Sorry, this was actually just human error.
They forgot to add the file I gave them.
I'll get it added to the repository post-haste.
(The patent grant is identical to the Go one)
> Define your service using Protocol Buffers,
Erm...
Cap'n proto and flatbuffers are much faster.
gRPC can be used with flatbuffers and similar. The experience has been targeting protobufs, but at its core it just expects a serialized message. Other formats can be made to work with relatively low effort. So if protobuf is the issue, try swapping to your favorite marshaller.