Saturday, October 24, 2015

gRPC, first impression

Google recently released gRPC,  a new open source RPC framework. It appears to be a modified version of Google internal RPC framework for its distributed system. I heard it from another software engineer a couple of days ago. Out of curiosity, I took a look.

It is yet another RPC, thus has many similarity with existing RPC framework, say DCE/RPC and MS-RPC. What is RPC? In short, RPC disguises underlying message passing across process/machine boundary with function call. To convert a function call (parameters and return value) to messages (binary stream), RPC framework provides an interface definition language (IDL) for user to define the contract between client and servers. IDL compiler will generate code for function parameters/return value marshaling. gRPC's IDL is documented here. Since the message passing protocol is independent from higher level constructs in RPC runtime, an RPC framework can support multiple message passing protocols, from private binary protocol to HTTP. gRPC can use HTTP/2.

In my day to day work, I heavily use COM (Component Object Model of Microsoft) for IPC on a single machine. COM is built on top of MS-RPC but object-oriented. COM MTA local server and gRPC server are very similar at RPC runtime level. COM doesn't go beyond machine boundary, though DCOM can. But DCOM and CORBA have fallen out of favor (see First Law of Distributed Objects). gRPC's design eliminates the use of remote object reference, thus avoid pitfalls of (fine grained) distributed objects.

gRPC vs MS-RPC by examples, I am sure you will find almost one-to-one map of concepts.

http://www.grpc.io/docs/tutorials/basic/c.html#simple-rpc
http://www.codeproject.com/Articles/4837/Introduction-to-RPC-Part

Technologies similar to COM: D-BusAndroid Binder and Apple's XPC Services















  




No comments:

Post a Comment