Home > front end >  How are gRPCs faster than REST API? And How exactly is it idiomatic
How are gRPCs faster than REST API? And How exactly is it idiomatic

Time:12-02

I am learning about gRPCs at the moment and everything feels like a bunch of buzzwords that I am struggling to put together.

I understand gRPCs use proto buffers, but what do they do differently from a normal JSON config?

CodePudding user response:

gRPC is a high-performance, open-source universal RPC framework. It uses HTTP/2 for transport, Protocol Buffers as the default serialization mechanism, and provides features such as authentication, bidirectional streaming and flow control, blocking or nonblocking bindings, and cancellation and timeouts.

One of the main advantages of gRPC is that it uses binary data for both request and response messages, as opposed to REST APIs which use human-readable JSON text. This allows gRPC to be more efficient and compact, resulting in faster transmission times and lower network overhead.

In addition, gRPC uses a statically-typed interface definition language (IDL) called Protocol Buffers to define the service and the data structures that are exchanged. This allows the gRPC framework to generate client and server code automatically in multiple languages, making it easier to develop and maintain distributed systems.

In terms of being "idiomatic," gRPC is designed to be used with modern programming languages and to support a wide range of programming paradigms. This means that it provides a natural and intuitive way of defining and using RPC services within the context of a specific programming language. For example, in languages like Go, gRPC services can be defined using native language constructs, making it feel like a natural and idiomatic part of the language.

  • Related