Go

gRPC

Protocol Buffers, gRPC services, streaming, interceptors, error handling, metadata

22 pytań z rozmów·
Mid-Level
1

What is gRPC?

Odpowiedź

gRPC is an open-source RPC (Remote Procedure Call) framework developed by Google that uses HTTP/2 as transport protocol and Protocol Buffers as the default serialization format. Unlike REST which uses JSON and HTTP/1.1, gRPC offers better performance thanks to Protocol Buffers' binary format and HTTP/2 advanced features (multiplexing, header compression, server push). gRPC is widely used for microservices communication because it natively supports bidirectional streaming, client/server code generation, and strongly-typed interfaces.

2

What is the main role of Protocol Buffers in gRPC?

Odpowiedź

Protocol Buffers (protobuf) is the Interface Definition Language (IDL) and binary serialization format used by default in gRPC. It allows defining message structures and services in .proto files, which are then compiled to automatically generate client and server code in different languages. Protobuf's binary format is 3 to 10 times more compact than JSON and offers significantly superior serialization/deserialization performance (up to 20 times faster). This makes gRPC particularly suitable for high-frequency communication between microservices.

3

What is the difference between a Unary gRPC call and a Server Streaming call?

Odpowiedź

A Unary call is the simplest gRPC call type: the client sends a single request and receives a single response, similar to a classic HTTP REST request. A Server Streaming call allows the client to send a single request but receive a stream of multiple responses from the server. For example, a notifications API can use Server Streaming to send multiple updates to the client without the client having to poll. This reduces latency and network overhead compared to repeated Unary calls.

4

Which Go package is used to create a gRPC server?

5

How to define a gRPC service in a .proto file?

+19 pytań z rozmów

Opanuj Go na następną rozmowę

Uzyskaj dostęp do wszystkich pytań, flashcards, testów technicznych, ćwiczeń code review i symulatorów rozmów.

Zacznij za darmo