gRPC in 2 minutes
2 minutes or less
Local procedure call is a function call within the same process. In contrast, RPC stands for Remote Procedure Call, which is a function call in a remote process (on a different machine or thread).
gRPC is a popular implementation of RPC. It is used by organisations like Netflix, Square, Cisco as a preferred mechanism to connect a large number of (micro)services written in various languages in on-premise or cloud environments.
Why is gRPC so useful?
It is easy to create scalable, robust, type-safe APIs.
It officially supports around 11 languages, and has a thriving developer ecosystem.
It uses protocol buffers as the default data interchange format to encode and send data over the wire.
Protocol buffer is like JSON, except it's smaller and faster, and it generates native language bindings.
It is platform and language agnostic.
It has high performance out of the box.
Protocol buffer is a compact and efficient binary encoding format. Because of binary encoding and network optimisation, it is 5x faster than JSON.
It is built on top of HTTP/2 which supports multiplexing, stream prioritisation, binary protocol, server push etc. gRPC uses HTTP/2 streams and allows multiple streams of messages over a single long-lived TCP connection.
Why is gRPC not widely implemented (yet)?
gRPC relies on lower-level access to HTTP/2 primitives - currently the browser support is limited.
Where should you use it?
It’s the communication mechanism of choice between (micro)services in a data-centre or cloud.
It’s efficiency, compact data-interchange format, and performance makes it ideal for bandwidth constraint environments like mobile and smart or embedded devices.