Junior — Middle
Could you explain what gRPC is and how it works?
sobes.tech AI
Answer from AI
gRPC is a modern framework for remote procedure calls (RPC), developed by Google. It allows clients to invoke methods on a server as if they were local.
Main features of gRPC:
- Uses Protocol Buffers (protobuf) for describing services and serializing data — a compact and fast format.
- Supports several types of interaction: unary (one request — one response), server streaming, client streaming, and bidirectional streaming.
- Operates over HTTP/2, which provides request multiplexing, header compression, and low latency.
Example of operation:
- A service and methods are defined in a .proto file.
- Using the protobuf compiler, client and server code are generated.
- The server implements the service methods.
- The client calls methods, and gRPC handles message transmission and connection management.
This is convenient for microservice architecture, where performance and strict typing are important.