Go

gRPC

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

22 면접 질문·
Mid-Level
1

What is gRPC?

답변

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?

답변

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?

답변

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 면접 질문

다음 면접을 위해 Go을 마스터하세요

모든 질문, flashcards, 기술 테스트, 코드 리뷰 연습, 면접 시뮬레이터에 접근하세요.

무료로 시작하기