rip rest : gRPC is the new cool thing
Wednesday July 22nd 2020 by SocraticDev
gRPC is a modern open source high performance RPC framework that can run in any environment. It can efficiently connect services in and across data centers with pluggable support for load balancing, tracing, health checking and authentication. It is also applicable in last mile of distributed computing to connect devices, mobile applications and browsers to backend services.
The coming end of the HTTP REST protocol?
The arrival of
gRPC on the web probably signals the end of the omnipotence of REST APIs. The performance and interoperability requirements for modern systems favor this newcomer.
gRPCwins in terms of performance. It ensures the transmission of light messages in binary form while REST transmits character strings in
JSONformat which are heavier on the network. This makes a noticeable difference for smartphones
- All gRPC framework (available to most popular programming languages) ensure flawless boiler-plate code generation for building binary message clients and servers. Automatic generation of these critical entities will save developers precious time ... and avoid errors that are difficult to diagnose!
- Much like Microsoft's
gRPCenforces strict specifications.
JSONmessages do not impose any specifications. Unfortunately, today's web developers are constantly debating over
HTTP verbsand appropriate return codes.
gRPensures a consistent developer experience across all platforms and across all implementations.
gRPC, via the
HTTP/2protocol, supports all types of streaming: unary, server-to-client, client-to-server and bi-directional
gRPCallows the client to manage the behavior of remote procedures: deadlines, timeouts and cancellations
- Micro-services where low latency and high onset are required
- Bi-directional point-to-point communication in real time
- Polyglot environments where several programming languages are used:
gRPCoffers complete frameworks in several languages.
- Environments where network capacity is limited. A
gRPCmessage will always be much lighter than a
Weaknesses of gRPC
- Modern browsers do not currently support
gRPC. Microsoft's bet is to promote the adoption of
Blazor. A framework which offers a
gRPCcompatible web client
binary buffers, messages exchanged between clients and servers, are not human-readable
gRPChas limitations in terms of realtime broadcast over a network. For this use case, an async notification frameworks like
SignalRis more suitable
- Because it requires
HTTP/2clients, inter-process communication is better served by other technologies that can do without them. For example, Microsoft uses
pipesas a lightweight method of rapid communication between processes.