gRPC는 Google이 개발한 고성능 오픈소스 범용 RPC 프레임워크입니다. gRPC에서 클라이언트 애플리케이션은 다른 머신의 서버 애플리케이션에 있는 메소드를 로컬 객체처럼 직접 호출할 수 있으므로 분산 애플리케이션 및 서비스를 더 쉽게 만들 수 있습니다.
gRPC를 사용하여 얻을 수 있는 주요 장점 중 하나는 문서입니다. 서비스 구성 및 API 인터페이스 정의 파일을 사용하여 API용 참조 문서를 생성할 수 있습니다.
API 관리
gRPC용 API 게이트웨이에서는 API 게이트웨이의 API 관리 기능을 사용하여 모니터링, 호스팅, 추적, 인증 등을 Cloud Run의 gRPC 서비스에 추가할 수 있습니다. 또한 특수 매핑 규칙을 지정하면 API 게이트웨이가 HTTP를 통해 RESTful JSON을 gRPC 요청으로 변환합니다. 즉, API 게이트웨이에서 관리하는 gRPC 서버를 배포하고 gRPC 또는 JSON/HTTP 클라이언트를 사용하여 해당 API를 호출할 수 있으므로 다른 시스템과의 통합이 훨씬 더 유연하고 간편해집니다.
gRPC를 지원하는 모든 언어로 API 게이트웨이용 gRPC 서비스를 만들 수 있습니다. 서비스 및 클라이언트를 만들기 위한 빠른 시작과 가이드를 비롯하여 gRPC에 대한 자세한 내용은 gRPC 사이트에서 확인할 수 있습니다.
서비스 정의 및 구성
gRPC는 서비스를 정의하고 매개변수 및 반환 유형을 사용하여 원격으로 호출 가능한 메서드를 지정한다는 개념을 기반으로 합니다. 기본적으로 gRPC는 서비스 인터페이스와 페이로드 메시지의 구조를 설명하는 인터페이스 정의 언어(IDL)로 프로토콜 버퍼를 사용합니다.
// The greeting service definition.serviceGreeter{// Sends a greetingrpcSayHello(HelloRequest)returns(HelloReply){}}// The request message containing the user's name.messageHelloRequest{stringname=1;}// The response message containing the greetingsmessageHelloReply{stringmessage=1;}
API 게이트웨이에 gRPC를 사용하려면 서비스 정의와 함께 서비스 구성을 제공해야 합니다. 이를 통해 인증, 서비스에 포함되는 API, HTTP 요청에서 gRPC 메서드로의 매핑, 특수한 API 게이트웨이 설정을 비롯한 서비스의 런타임 동작이 구성됩니다.
트랜스코딩
API 게이트웨이는 클라이언트가 HTTP/JSON를 사용해서 API 게이트웨이를 통해 gRPC 서비스와 통신할 수 있도록 Cloud Run에서 gRPC 서비스에 대한 프로토콜 변환 기능을 제공합니다.
가장 일반적인 사용 사례는 브라우저 클라이언트가 gRPC 클라이언트 라이브러리의 특별한 지원 없이 gRPC 서버와 통신할 수 있도록 하는 것입니다. API 게이트웨이는 서비스 구성의 일부로 HTTP 요청을 gRPC 메서드에 매핑하기 위한 메커니즘을 제공합니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-09-03(UTC)"],[[["\u003cp\u003egRPC is a high-performance, open-source RPC framework that allows client applications to directly call methods on a server application as if they were local objects.\u003c/p\u003e\n"],["\u003cp\u003eAPI Gateway for gRPC enhances gRPC services by offering API management features such as monitoring, hosting, tracing, and authentication.\u003c/p\u003e\n"],["\u003cp\u003eAPI Gateway can translate RESTful JSON over HTTP into gRPC requests, enabling flexibility by supporting both gRPC and JSON/HTTP clients.\u003c/p\u003e\n"],["\u003cp\u003egRPC services use protocol buffers as the Interface Definition Language (IDL) to define services, methods, parameters, and return types, and require a service configuration for runtime behavior.\u003c/p\u003e\n"],["\u003cp\u003eAPI Gateway supports protocol translation for gRPC services, enabling HTTP/JSON clients to interact with gRPC services, but payload compression and IDLs other than protocol buffers are not currently supported.\u003c/p\u003e\n"]]],[],null,["# gRPC overview\n=============\n\n[gRPC](http://www.grpc.io) is a high performance, open-source universal RPC\nframework, developed by Google. In gRPC, a client application can directly call\nmethods on a server application on a different machine as if it was a local\nobject, making it easier to create distributed applications and services.\n\nOne of the primary benefits of using gRPC is for documentation; you can use\nyour service configuration and API interface definition files to generate\nreference documentation for your API.\n\nAPI management\n--------------\n\nWith API Gateway for gRPC, you can use the API management\ncapabilities of API Gateway to add monitoring,\nhosting, tracing, authentication, and more to your gRPC services on Cloud Run. In addition,\nonce you specify special mapping rules, API Gateway translates RESTful JSON over HTTP\ninto gRPC requests. This means that you can deploy a gRPC server managed by\nAPI Gateway and call its API using a gRPC or JSON/HTTP client,\ngiving you much more flexibility and ease of integration with other systems.\n\nYou can create gRPC services for API Gateway in any gRPC-supported language. You can find out much more about gRPC,\nincluding quickstarts and tutorials for creating servers and clients, on the\n[gRPC site](http://www.grpc.io/docs/).\n\nService definition and configuration\n------------------------------------\n\ngRPC is based on the idea of defining a **service** , specifying the methods\nthat can be called remotely with their parameters and return types. By default,\ngRPC uses [protocol buffers](https://developers.google.com/protocol-buffers/docs/overview)\nas the Interface Definition Language (IDL) for describing both the service\ninterface and the structure of the payload messages. \n\n // The greeting service definition.\n service Greeter {\n // Sends a greeting\n rpc SayHello (HelloRequest) returns (HelloReply) {}\n }\n\n // The request message containing the user's name.\n message HelloRequest {\n string name = 1;\n }\n\n // The response message containing the greetings\n message HelloReply {\n string message = 1;\n }\n\nTo use gRPC with API Gateway, you must provide a\n[service configuration](/api-gateway/docs/grpc-service-config)\nalong with the service definition. This configures the runtime\nbehavior of your service, including authentication, the API(s) included in the\nservice, mappings from HTTP requests to gRPC methods, and special API Gateway settings.\n\nTranscoding\n-----------\n\nAPI Gateway provides protocol translation for your gRPC services on Cloud Run\nallowing clients to use HTTP/JSON to communicate with a gRPC service through the API Gateway.\n\nThe most common use case is allowing browser clients to talk to gRPC servers\nwithout special support from gRPC client libraries. API Gateway\nprovides a mechanism for mapping HTTP requests to gRPC methods as part of\n[service configuration](/api-gateway/docs/grpc-service-config).\n\nYou can find out more about this in [Transcoding HTTP/JSON to gRPC](/endpoints/docs/grpc/transcoding).\n| **Note** : When using gRPC transcoding, request and response body sizes exceeding **one megabyte** may result in `500 Internal Server Error` responses.\n|\n| If this size is exceeded, request logs for API Gateway will show\n| *grpc_json_transcode_failure{request_buffer_size_limit_reached}*\n| or *grpc_json_transcode_failure{response_buffer_size_limit_reached}* in the\n| *responseDetails* field.\n\nLimitations\n-----------\n\nThe following gRPC features are not yet supported in API Gateway:\n\n- Payload compression\n- Any IDL other than protocol buffers\n\nAPI Gateway only supports Cloud Run\ngRPC services at this time.\n\nWhat's next\n-----------\n\n- Explore samples. The `getting-started-grpc` sample is available on GitHub in the following languages:\n - [Java](https://github.com/GoogleCloudPlatform/java-docs-samples/tree/master/endpoints/getting-started-grpc)\n - [Python](https://github.com/GoogleCloudPlatform/python-docs-samples/tree/master/endpoints/getting-started-grpc)\n - [Ruby](https://github.com/GoogleCloudPlatform/ruby-docs-samples/tree/master/endpoints/getting-started-grpc)\n - [Go](https://github.com/GoogleCloudPlatform/golang-samples/tree/master/endpoints/getting-started-grpc)\n - [Node.js](https://github.com/GoogleCloudPlatform/nodejs-docs-samples/tree/master/endpoints/getting-started-grpc)\n- The Bookstore sample is available in the following languages:\n - [Python](https://github.com/GoogleCloudPlatform/python-docs-samples/tree/master/endpoints/bookstore-grpc)\n - [Java](https://github.com/GoogleCloudPlatform/java-docs-samples/tree/master/endpoints)"]]