Definition

gRPC

What is gRPC?

GRPC is a high-performance remote procedure call framework released by Google in August 2016. Since then, gRPC has gained favor across both open source and enterprise communities as a way to accommodate the client-server interactions needed for things like cross-platform development and microservice architecture design.

GRPC can simplify the process for developers to build connected systems by connecting services in and across data centers. It also provides pluggable support for tracing, health checking, load balancing and authentication.

Developers often use gRPC for mobile and web client interactions since it can generate libraries for Android and iOS. Additionally, it uses standards-based HTTP transport protocols so it can cross security firewalls and access intermediary proxies.

Supported programming languages

GRPC clients and servers can run and communicate with each other in various environments, including a user's desktop or servers inside Google's network. Furthermore, gRPC clients can be written in a number of popular programming languages, including (but not limited to):

  • Java
  • C# and C++
  • Objective-C
  • Ruby
  • Python
  • Go

On top of this, developers can create a gRPC server in Java with clients in Python, Ruby or Go. Additionally, since the latest Google APIs have gRPC versions of their interfaces, developers can build Google functionality into their applications.

Benefits of using gRPC

GRPC, like other RPC systems, revolves around the idea of defining a service, such as identifying the methods that can be remotely called with their parameters and return types. However, gRPC provides sophisticated technologies that are efficient and scalable, such as HTTP/2 and streams. Since it is technology-agnostic, it can be used by and interact with server and clients from several different programming languages.

GRPC is also built upon protocol buffers, also known as protobuf. Protocol buffers are Google's tool for sequencing structured data, which allows for communication and data storage that can be predicted and analyzed.

Types of gRPC

Currently, gRPC lets developers define four types of service methods, which bear a resemblance to other traditional RPC call methods:

Unary RPC

A basic function call: The client sends one request to the server, then gets a single response back.

Server streaming

The client sends a request to the server and receives a stream of messages in return. The client reads from the returned stream until there are no messages left. Here, gRPC maintains message ordering within an individual RPC call.

Client streaming

The opposite of server streaming, the client writes a sequence of messages and sends them to the server, using a provided stream. Once the client has finished writing the messages, it waits for the server to read them and return its responses. Again, gRPC maintains message ordering within an individual RPC call.

Bidirectional streaming

Both the client and server send a sequence of messages via a read/write stream. The two streams work independently of each other and, as such, the clients and servers can read and write in any order. For instance, the server reads a message then writes a response. Or the server waits to receive all the client messages before writing its responses. To keep track, gRPC preserves the order of messages in each stream.

This was last updated in December 2022

Continue Reading About gRPC

Dig Deeper on Application development and design

Search Software Quality
Cloud Computing
TheServerSide.com
Close