In conversation with Google’s gRPC | Part1

Question:- How does the world of Micro-services looks like today ?

Answer:- Today’s world is to build micro-services and you’ve heard it before and micro-services built in multiple languages shall cover your business functions. For example, Let’s take another example of below scenario :-

  • Buying-Service where users buy things right.

So, all in all you get a lot of micro-services in many different languages and they have to talk to each other.

Question:- What all is involved when two or more Micro-services exchanges information amongst themselves ?

Answer:- When two or more Micro-services exchanges information amongst themselves, following stuff are involved :-

Question:- Let’s talk about what all intricacies are involved, while we are designing any API ?

Answer:- Following are the things we need to deep dive, when we are developing any micro-service :-

Above list actually, is sufficient to scare anyone who is stepping their foot in the world of building a micro-service OR Restful API.

Question:- Does there not exists any framework, which can solve all of the listed problems above ?

Answer:- Well, there exist a glossy framework, known as gRPC :-

Question:- Ok, let’s get back to basics, what is an RPC ?

Answer:- It’s a remote procedure call in your client code. Basically, it looks like that, we’re going to be calling the function directly on the server.

  • Say, we have a function named createUser hosted @ server side.

So, as you can see in yellow-colour, the client code, directly run the function on the server, but something is happening over the network here. And that is what is called a RPC. And that’s what makes our RPCs great.

Question:- Is RPC a new concept ?

Answer:- RPC is not a new concept. It’s implemented very cleanly since many years ago.

Question:- How do we get started with gRPC ?

Question:- How does a sample-proto file looks like and explain it’s basic working ?

  • Here, we have a “Greeting” message.

Question:- Why are Protocol-Buffers in demand and widely preferred ?

Question:- Which all companies have used Protocol Buffers ? Why is this euphoria ?

Question:- What’s the fundamental ideology with which Protocol-Buffers works ?

Question:- Why gRPCs uses Protocol-Buffers why not JSONs for communications ?

Reason #1.) Lot of network-bandwidth is saved.

Reason #2.) Enhanced efficiency in communication on smaller devices.

Question:- Can we read Protocol-Buffers with our naked eyes ?

Answer:- We can’t read this using our eyes as it’s a byte buffer protocol that you won’t understand anything about. This will be less CPU intensive.

Question:- Can gRPC be used in any language, to build micro-service ?

Answer:- Yes, of-course, gRPCs are language-agnostic and can be used to code with any language. For example :-

Question:- What are the advantages of using Protocol-Buffers ?

Question:- Lets talk about the types of APIs available in gRPC ?

Answer:- There are following types of APIs available with gRPC :-

  • Unary → This is how a traditional API looks like with usual request/response. The client shall send one message to the server and would receive one response from the server. Unary RPC calls are well suited, when data to be transferred is small.

Question:- Lets talk about Unary vs others little more ?

Question:- Lets define the APIs/Services through gRPCs using ProtoBuffs ?

Answer:- Below is how we define the APIs (i.e. Protobuf Services) using gRPC :-

Question:- How do we achieve massive scalability using gRPCs ?

Answer:- Yes, it’s very much possible to scale the APIs/Services using gRPCs. To share a proof of scalability (as taken from google docs), Google have >10 billion of requests being made per second internally, which they serve using gRPCs.

Question:- Let’s talk about Security with gRPCs ?

Question:- Let’s revisit, how does a RESTful API works with HTTP/1 ?

Question:- Can you talk about the differences between REST & gRPC ?

Answer:- Following are the differences between REST & gRPC :-

  • REST shall be using JSON as data-transfer standard which would be slower, bigger and text-based while gRPC uses the protobuf as data-transfer standard which are smaller and faster in nature.

Question:- Let’s conclude our learnings about gRPCs by now ?

That’s all in this section. If you liked reading this blog, kindly do press on clap button multiple times, to indicate your appreciation. We would see you in next series.

References :-

--

--

Software Engineer for Big Data distributed systems

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store