Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Protocol Buffers Java RPC Stack

According to this Wikipedia entry:

"Protocol Buffers is very similar to Facebook’s Thrift protocol, except it does not include a concrete RPC stack to use for defined services. Since Protocol Buffers was open sourced, a number of RPC stacks have emerged to fill this gap."

However, there are no examples of RPC stacks cited. Can anyone suggest a Java-based implementation of an RPC stack?

like image 255
Adamski Avatar asked Sep 17 '09 09:09

Adamski


People also ask

What is RPC Protobuf?

Protocol buffers, or Protobuf, is Google's serialization/deserialization protocol that enables the easy definition of services and auto-generation of client libraries. gRPC uses this protocol as their Interface Definition Language (IDL) and serialization toolset.

Does Protobuf work over HTTP?

Protobufs work fine over HTTP in their native binary format. Overcomplicated? Sure, if you want to transfer binary content then just use Protobufs and REST.

What is faster than Protobuf?

TL;DR — encoding and decoding string-intensive data in JavaScript is faster with JSON than it is with protobuf. When you have structured data in JavaScript, which needs to be sent over the network (for another microservice for example) or saved into a storage system, it first needs to be serialized.

What is the use of protocol buffers?

Protocol buffers are Google's language-neutral, platform-neutral, extensible mechanism for serializing structured data – think XML, but smaller, faster, and simpler.


2 Answers

If you want Java-based RPC stack, it's RMI. However, it doesn't work well cross platform.

I've been using ProtoBuf to do RPC. You can pretty much simulate an RPC stack by wrapping a protobuf message inside another protobuf, which defines the services or calls. Find my answer to this question for details,

Google Protocol Buffers and HTTP

Thrift looks like a very good alternative if you want support more platforms like PHP, Ruby, C# etc. However, it looks very complex to me compared to ProtoBuf.

like image 200
ZZ Coder Avatar answered Sep 23 '22 19:09

ZZ Coder


Google has open sourced their RPC framework gRPC, which uses Protocol Buffers to define the service and messages. gRPC is cross-platform with support for C, C++, C#, Java, Go, Node.js, Python, Ruby, Objective-C and PHP.

gRPC is based on the HTTP/2 standard that enables new capabilities such as bidirectional streaming, flow control, header compression and multiplexed connections.

like image 27
coder.chenzhi Avatar answered Sep 20 '22 19:09

coder.chenzhi