# gRPC (Go) > Protocol Buffers、gRPC サービス、ストリーミング、interceptor、エラー処理、メタデータ - 22 面接問題 - Mid-Level - [面接問題: Go](https://sharpskill.dev/ja/technologies/go/interview-questions.md) ## 1. gRPC とは何ですか? **回答** gRPC は Google が開発したオープンソースの RPC(Remote Procedure Call)フレームワークで、トランスポートプロトコルとして HTTP/2 を、デフォルトのシリアライズ形式として Protocol Buffers を使用します。JSON と HTTP/1.1 を使う REST とは異なり、gRPC は Protocol Buffers のバイナリ形式と HTTP/2 の高度な機能(multiplexing、ヘッダー圧縮、server push)によってより高いパフォーマンスを提供します。gRPC は双方向ストリーミング、クライアント/サーバーのコード生成、強い型付けをネイティブにサポートするため、マイクロサービス間の通信で広く利用されています。 ## 2. gRPC における Protocol Buffers の主な役割は何ですか? **回答** Protocol Buffers(protobuf)は gRPC でデフォルトに使われるインターフェース定義言語(IDL)かつバイナリシリアライズ形式です。.proto ファイルでメッセージとサービスの構造を定義でき、それをコンパイルすることで複数の言語のクライアント/サーバーコードを自動生成します。protobuf のバイナリ形式は JSON より 3〜10 倍コンパクトで、シリアライズ/デシリアライズのパフォーマンスが格段に優れています(最大 20 倍高速)。これにより gRPC はマイクロサービス間の高頻度通信に特に適しています。 ## 3. gRPC の Unary 呼び出しと Server Streaming 呼び出しの違いは何ですか? **回答** Unary 呼び出しは最もシンプルな gRPC 呼び出しタイプで、クライアントは 1 つのリクエストを送り、1 つのレスポンスを受け取ります。これは従来の HTTP REST リクエストに似ています。Server Streaming 呼び出しでは、クライアントは 1 つのリクエストを送りますが、サーバーから複数のレスポンスのストリームを受け取れます。たとえば、通知 API は Server Streaming を使って、クライアントがポーリングすることなく複数の更新を送信できます。これは繰り返しの Unary 呼び出しに比べてレイテンシとネットワーク負荷を削減します。 ## さらに19問利用可能 - gRPC サーバーを作成するために使用される Go パッケージはどれですか? - .proto ファイルで gRPC サービスを定義するにはどうしますか? 無料で登録: https://sharpskill.dev/ja/login ## その他のGo面接トピック - [Goの基礎](https://sharpskill.dev/ja/technologies/go/interview-questions/go-basics.md): 25問, Junior - [Goのデータ構造](https://sharpskill.dev/ja/technologies/go/interview-questions/go-data-structures.md): 20問, Junior - [Go のインターフェース](https://sharpskill.dev/ja/technologies/go/interview-questions/go-interfaces.md): 18問, Junior - [エラー処理](https://sharpskill.dev/ja/technologies/go/interview-questions/error-handling.md): 20問, Junior - [Goroutine の基礎](https://sharpskill.dev/ja/technologies/go/interview-questions/goroutines-basics.md): 20問, Junior - [Channels](https://sharpskill.dev/ja/technologies/go/interview-questions/channels.md): 22問, Junior - [Go Modules](https://sharpskill.dev/ja/technologies/go/interview-questions/go-modules.md): 18問, Mid-Level - [HTTP サーバー](https://sharpskill.dev/ja/technologies/go/interview-questions/http-server.md): 24問, Mid-Level - [HTTPクライアント](https://sharpskill.dev/ja/technologies/go/interview-questions/http-client.md): 18問, Mid-Level - [JSON エンコーディング](https://sharpskill.dev/ja/technologies/go/interview-questions/json-encoding.md): 20問, Mid-Level - [Database/SQL](https://sharpskill.dev/ja/technologies/go/interview-questions/database-sql.md): 22問, Mid-Level - [context パッケージ](https://sharpskill.dev/ja/technologies/go/interview-questions/context-package.md): 20問, Mid-Level - [Testing](https://sharpskill.dev/ja/technologies/go/interview-questions/testing.md): 22問, Mid-Level - [並行処理パターン](https://sharpskill.dev/ja/technologies/go/interview-questions/concurrency-patterns.md): 24問, Mid-Level - [同期プリミティブ](https://sharpskill.dev/ja/technologies/go/interview-questions/sync-primitives.md): 22問, Mid-Level - [Go Web フレームワーク](https://sharpskill.dev/ja/technologies/go/interview-questions/go-web-frameworks.md): 20問, Mid-Level - [REST API 設計](https://sharpskill.dev/ja/technologies/go/interview-questions/rest-api-design.md): 20問, Mid-Level - [Reflection](https://sharpskill.dev/ja/technologies/go/interview-questions/reflection.md): 20問, Senior - [メモリ管理](https://sharpskill.dev/ja/technologies/go/interview-questions/memory-management.md): 24問, Senior - [パフォーマンス最適化](https://sharpskill.dev/ja/technologies/go/interview-questions/performance-optimization.md): 22問, Senior - [Generics](https://sharpskill.dev/ja/technologies/go/interview-questions/generics.md): 20問, Senior - [Go Design Patterns](https://sharpskill.dev/ja/technologies/go/interview-questions/design-patterns.md): 24問, Senior - [Microservices](https://sharpskill.dev/ja/technologies/go/interview-questions/microservices.md): 24問, Senior - [セキュリティと認証](https://sharpskill.dev/ja/technologies/go/interview-questions/security-authentication.md): 24問, Senior - [Docker & Containerization](https://sharpskill.dev/ja/technologies/go/interview-questions/docker-containerization.md): 20問, Senior - [Kubernetes Basics](https://sharpskill.dev/ja/technologies/go/interview-questions/kubernetes-basics.md): 22問, Senior - [高度な Go](https://sharpskill.dev/ja/technologies/go/interview-questions/advanced-go.md): 20問, Senior - [CLI開発](https://sharpskill.dev/ja/technologies/go/interview-questions/cli-development.md): 20問, Senior --- Source: SharpSkill (https://sharpskill.dev), tech interview preparation for your real stack. HTML version of this page: https://sharpskill.dev/ja/technologies/go/interview-questions/grpc