Showing posts with label gRPC. Show all posts
Showing posts with label gRPC. Show all posts

Friday, 18 March 2022

Protobuf ?

Hello friends this is a follow-up to my earlier post related to gRPC Vs Restconf and as promised below is a quick summary on Protobuf (the idea that made gRPC look so good). 



Before I summarize Protobuf, let's revisit what serialization is?  Serialization is taking a complex data structure and serializing it into a string that can be sent over a connection. The recipient will use the de-serialization process to recover the original data structure. Serialization is also required when you want to save data structure to a file. Some popular forms of serialization are JSON, YAML, XML, and protocol buffers(Protobuf).

Protobuf is a method of serializing data that can be transmitted over wire or be stored in a file. 

Two keywords to remember when we talk about Protobuf - Protobuf is platform-neutral and highly optimized for microservices architecture. 

As of 2019, Google has over 48000 Protobuf message types in 12000 .proto files.

Speed:

Protobuf is faster than XML/JSON serialization as it offloads the description of data in a proto file. 

20-100x times faster than XML 

Network bandwidth:

Protobuf utilizes binary transmission format over string used by JSON/XML thus less bandwidth is required during transmission. 

3-10X smaller than JSON/XML



Throughput:

Protobuf payload size is ~60% smaller than JSON. 

JSON is self-contained while Protobuf utilizes schema(.proto) files to keep a record of data types and schema.

Courtesy: Geoffery Hunter

Backward compatibility: 

Super easy, if the new change does not work move to your last known good proto file schema.

Polyglot support:

Protobuf support many popular programming languages like C#, Go, python, Java, Javascript.

Engineer productivity :

Protobuf support automatic client code generation using code generators, just specify the proto file with the target language.


However, there are times when JSON is a better fit:

 1) Data to be human readable(protobuf is binary)

 2) Data is consumed directly by a web browser(right now there is no support in web-browser for protobuf)

 3) When your server-side application is in javascript.

 4) JSON is self-contained (protobuf needs a proto file) 


Next post gRPC :)


References:

Serialization formats - Geoffrey Hunter

My earlier post on gRPC Vs Restconf




Friday, 11 March 2022

gRPC Vs RESTCONF

Hello friends this is the follow-up post of my previous post on Netconf Vs Restconf and in this post, I have tried to compare gRPC with RESTCONF implementation. I hope this shall provide an answer to "why gRPC". 

Microservices-based architecture is the contemporary software design and development practice and gRPC is the best option because of its unmatched performance and polyglot(many programming languages) support. 

Per google gRPC is 

"a modern, bandwidth and CPU efficient, low latency way to create massively distributed systems that span data centers, as well as power mobile apps, real-time communications, IoT devices and APIs"


Let's summarize the main difference between gRPC and RESTCONF


What could be the limitations of using gRPC?

1. Higher ramp-up time of development teams 

2. You cannot call a gRPC service from a web browser (because of HTTP/2) and need a proxy 

Next post let's deal with protobuf  :) Happy reading


References:

Google blog - gRPC

My earlier post on NETCONF Vs RESTCONF 

A short youtube video(Why gRPC ?)


Protobuf ?

Hello friends this is a follow-up to my earlier post related to gRPC Vs Restconf and as promised below is a quick summary on Protobuf (the...